<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<ul id="index">
  <li><a href="#Issues-fixed-after-release-20210625">Issues fixed after release 20210625</a></li>
  <li><a href="#Issues-fixed-after-release-20210402">Issues fixed after release 20210402</a></li>
  <li><a href="#Issues-fixed-after-release-20210111">Issues fixed after release 20210111</a></li>
  <li><a href="#Issues-fixed-after-release-20201207">Issues fixed after release 20201207</a></li>
  <li><a href="#Issues-fixed-after-release-20201202">Issues fixed after release 20201202</a></li>
  <li><a href="#Issues-fixed-after-release-20201001">Issues fixed after release 20201001</a></li>
  <li><a href="#Issues-fixed-after-release-20200907">Issues fixed after release 20200907</a></li>
  <li><a href="#Open-Issues">Open Issues</a></li>
</ul>

<h1 id="Issues-fixed-after-release-20210625">Issues fixed after release 20210625</h1>

<dl>

<dt id="Fix-to-make--wn-and--bbxx-n-flags-work-together"><b>Fix to make -wn and -bbxx=n flags work together</b></dt>
<dd>

<p>Testing with random parameters produced some cases where the combination of -wn and various -bbxx=n flags were not working together. To illustrate, consider the following script (-sil=1 just means start at 1 indentation level)</p>

<pre><code>    # perltidy -sil=1
    $$d{&quot;day_name&quot;} = [
        [
            &quot;lundi&quot;,    &quot;mardi&quot;,  &quot;mercredi&quot;, &quot;jeudi&quot;,
            &quot;vendredi&quot;, &quot;samedi&quot;, &quot;dimanche&quot;
        ]
    ];</code></pre>

<p>With welding we get:</p>

<pre><code>    # -sil=1 -wn
    $$d{&quot;day_name&quot;} = [ [
        &quot;lundi&quot;,    &quot;mardi&quot;,  &quot;mercredi&quot;, &quot;jeudi&quot;,
        &quot;vendredi&quot;, &quot;samedi&quot;, &quot;dimanche&quot;
    ] ];</code></pre>

<p>With -bbsb=3 (--break-before-square-brackets) we get:</p>

<pre><code>    # -sil=1 -bbsb=3
    $$d{&quot;day_name&quot;} =
      [
        [
            &quot;lundi&quot;,    &quot;mardi&quot;,  &quot;mercredi&quot;, &quot;jeudi&quot;,
            &quot;vendredi&quot;, &quot;samedi&quot;, &quot;dimanche&quot;
        ]
      ];</code></pre>

<p>So far, so good. But for the combination -bbsb=3 -wn we get</p>

<pre><code>    # OLD: ERROR
    # -sil=1 -bbsb=3 -wn
    $$d{&quot;day_name&quot;} = [ [
        &quot;lundi&quot;,    &quot;mardi&quot;,  &quot;mercredi&quot;, &quot;jeudi&quot;,
        &quot;vendredi&quot;, &quot;samedi&quot;, &quot;dimanche&quot;
    ] ];</code></pre>

<p>which is incorrect because it ignors the -bbsb flag. The corrected result is</p>

<pre><code>    # NEW: OK
    # -sil=1 -bbsb=3 -wn
    $$d{&quot;day_name&quot;} =
      [ [
        &quot;lundi&quot;,    &quot;mardi&quot;,  &quot;mercredi&quot;, &quot;jeudi&quot;,
        &quot;vendredi&quot;, &quot;samedi&quot;, &quot;dimanche&quot;
      ] ];</code></pre>

<p>This update fixes case b1173. It works for any number of welded containers, and the -bbxxi=n flags also work correctly.</p>

<p>16 Jul 2021.</p>

</dd>
<dt id="Fix-problem-with-side-comment-after-pattern"><b>Fix problem with side comment after pattern</b></dt>
<dd>

<p>Testing with randomly placed side comments produced an error illustrated with the following snippet:</p>

<pre><code>    testit
    /A (*THEN) X | B (*THEN) C/x#sc#
    ,
    &quot;Simple (*THEN) test&quot;
    ;</code></pre>

<p>If &#39;testit&#39; is an unknown bareword then perltidy has to guess if the &#39;/&#39; is a division or can start a pattern. In this case the side comment caused a bad guess. This is case c044 and is fixed with this update. There are no other known issues with side comments at the present time but testing continues.</p>

<p>13 Jul 2021, 8b36de8.</p>

</dd>
<dt id="Fix-problem-with-side-comment-after-pointer-part-3"><b>Fix problem with side comment after pointer, part 3</b></dt>
<dd>

<p>This update fixes some incorrect tokenization produced by a side comment placed between a pointer and a bareword as in this snippet:</p>

<pre><code>    sub tzoffset {};

    ...

    my $J
    +=
    (
    $self
    -&gt;#sc
    tzoffset
    / (
    24
    *
    3600
    )
    );</code></pre>

<p>If a sub declaration for the bareword has been seen, the following &#39;/&#39; was being rejected as an operator. This update fixes this case, which is issue c043.</p>

<p>13 Jul 2021, cab7ed3.</p>

</dd>
<dt id="Avoid-line-breaks-before-a-slash-in-certain-cases"><b>Avoid line breaks before a slash in certain cases</b></dt>
<dd>

<p>This is a modification to the previous update for case c039 which prevents a line break before a &#39;/&#39; character which follows a bareword or possible indirect object. This rule will be only be used to prevent creating new line breaks. Existing line breaks can remain.</p>

<p>11 Jul 2021, 7afee47.</p>

</dd>
<dt id="Fix-error-parsing-sub-attributes-with-side-comment"><b>Fix error parsing sub attributes with side comment</b></dt>
<dd>

<p>Testing with side comments produced an error in the following snippet:</p>

<pre><code>    sub plugh () :#
      Ugly(&#39;\(&quot;) : Bad;</code></pre>

<p>This is fixed in this update, case c038.</p>

<p>11 Jul 2021, 80f2a3a.</p>

</dd>
<dt id="Fix-case-b1172-a-failure-to-converge"><b>Fix case b1172, a failure to converge</b></dt>
<dd>

<p>Random testing produced case b1172, a failure to converge with unusual parametrs. This update fixes this case. There are no other known cases of instability at the present time but testing continues.</p>

<p>10 Jul 2021, 47e7f9b.</p>

</dd>
<dt id="Avoid-line-breaks-before-a-slash-in-certain-cases1"><b>Avoid line breaks before a slash in certain cases</b></dt>
<dd>

<p>This update prevents a line break before a &#39;/&#39; character which follows a bareword or possible indirect object. The purpose is reduce the chance of introducing a syntax error in cases where perl is using spaces to distinguish between a division and the start of a pattern.</p>

<p>This fixes case c039.</p>

<p>10 Jul 2021, 461199c.</p>

</dd>
<dt id="Removed-warning-message-if-ending-in-code-skipping-section"><b>Removed warning message if ending in code skipping section</b></dt>
<dd>

<p>In the previous version, a warning was produced if a &#39;code-skipping&#39; opening comment &#39;#&lt;&lt;V&#39; was not followed by a closing comment &#39;#&gt;&gt;V&#39;. But the related &#39;format-skipping&#39; commands do not give a warning if a &#39;#&lt;&lt;&lt;&#39; comment is not ended with a &#39;#&gt;&gt;&gt;&#39; closing comment. In order to be able to smoothly change between these options, it seems best to remove the warning about a missing &#39;#&gt;&gt;V&#39;. There is still a message in the log file about this, so if there is any uncertainty about it, a log file can be saved and consulted.</p>

<p>10 Jul 2021, 461199c.</p>

</dd>
<dt id="Improve-logic-for-distinguishing-a-pattern-vs-a-division"><b>Improve logic for distinguishing a pattern vs a division</b></dt>
<dd>

<p>Testing with side comments produced the following snippet which caused a error due to the side comment on the &#39;/&#39;</p>

<pre><code>    $bond_str
    =
    VERY_WEAK #sc#
    / #sc#
    1.05
    ;</code></pre>

<p>Several related examples were found in which side comments triggered errors. For example</p>

<pre><code>    ok
    /[^\s]+/#sc#
    ,
    &#39;m/[^\s]/ utf8&#39;
    ;</code></pre>

<p>This update fixes these problems, case c040.</p>

<p>9 Jul 2021, ffe4351.</p>

</dd>
<dt id="Fix-problem-caused-by-side-comment-after"><b>Fix problem caused by side comment after ++</b></dt>
<dd>

<p>Testing with side comments produced an incorrect error message for this snippet:</p>

<pre><code>    xxx 
    ++#
    $test, 
    Internals::SvREADONLY( %$copy) , 
    &quot;cloned hash restricted?&quot; ;</code></pre>

<p>The problem was caused by the side comment between the &#39;++&#39; and &#39;$test&#39;. The same problem occurs for &#39;--&#39; instead of &#39;++&#39;. This is fixed with this update, case c042.</p>

<p>8 Jul 2021, 20cc9a0.</p>

</dd>
<dt id="Fix-problem-caused-by-side-comment-after-pointer-part-2"><b>Fix problem caused by side comment after pointer, part 2</b></dt>
<dd>

<p>This is related to the previous issue, c037. The following snippet was misparsed at the old style &#39; package separater due to the side comment following the pointer.</p>

<pre><code>    @ret
    =
    $o
    -&gt;#
    SUPER&#39;method
    (
    &#39;whatever&#39;
    )
    ;</code></pre>

<p>This is fixed in this update, case c041.</p>

<p>7 Jul 2021, 1806772.</p>

</dd>
<dt id="Fix-problem-caused-by-side-comment-after-pointer"><b>Fix problem caused by side comment after pointer</b></dt>
<dd>

<p>The following test script</p>

<pre><code>    is(
    $one
    -&gt;#sc#
    package
    ,
    &quot;bar&quot;
    ,
    &quot;Got package&quot;
    )
    ;</code></pre>

<p>Caused the following error message:</p>

<pre><code>  4: package
     ^
  found package where operator expected</code></pre>

<p>The problem was caused by a side comment between the pointer &#39;-&gt;&#39; and the word &#39;package&#39;. This caused package to be misparsed as a keyword, causing the error.</p>

<p>This is fixed in this update, case c037, 96f2ebb.</p>

</dd>
<dt id="Fix-error-parsing-and-similar-combinations"><b>Fix error parsing &#39;%#&#39; and similar combinations</b></dt>
<dd>

<p>Perltidy was correctly distinguishing between &#39;$#&#39; and &#39;$ #&#39; but not between &#39;@#&#39; and &#39;@ #&#39; and &#39;%#&#39; and &#39;% #&#39;. The coding for parsing these types of expressions has been corrected. Some simple examples:</p>

<pre><code>    # this is a valid program, &#39;%#&#39; is a punctuation variable
    %# = ( foo =&gt; &#39;bar&#39;, baz =&gt; &#39;buz&#39; );
    print keys(%#), &quot;\n&quot;;

    # but this is a syntax error (space before # makes a side comment)
    # (perltidy was ignoring the space and forming &#39;%#&#39; here)
    % # = ( foo =&gt; &#39;bar&#39;, baz =&gt; &#39;buz&#39; );
    print keys(%#), &quot;\n&quot;;

    # this is a valid program, &#39;@#&#39; is a punctuation variable
    @# = ( foo , &#39;bar&#39;, baz , &#39;buz&#39; );
    print @#, &quot;\n&quot;;

    # this is a valid program, the space makes the &#39;#&#39; a side comment
    # perltidy formed %# here, causing an error
    % #
    var = ( foo =&gt; &#39;bar&#39;, baz =&gt; &#39;buz&#39; );
    print keys(%var), &quot;\n&quot;;</code></pre>

<p>This fixes case c036.</p>

<p>6 Jul 2021, e233d41.</p>

</dd>
<dt id="Fix-error-parsing"><b>Fix error parsing &#39;&amp;#&#39;</b></dt>
<dd>

<p>The following test script caused an error when perltidy did not correctly parse the tight side comment after the &#39;&amp;&#39; (it parsed correctly if there was a space before the &#39;#&#39;).</p>

<pre><code>    print$my_bag
    &amp;#sc#
    $your_bag
    ,
    &quot;\n&quot;
    ;</code></pre>

<p>This update fixes this issue, c033.</p>

<p>5 Jul 2021, 0d784e0.</p>

</dd>
<dt id="Fix-error-parsing-format-statement"><b>Fix error parsing format statement</b></dt>
<dd>

<p>The following test script caused an error when perltidy took &#39;format&#39; to start a format statement.</p>

<pre><code>    my$ascii#sc#
    =#sc#
    $formatter#sc#
    -&gt;#sc#
    format#sc#
    (#sc#
    $html#sc#
    )#sc#
    ;#sc#</code></pre>

<p>This was fixed by requiring a format statement to begin where a new statement can occur. This fixes issue c035.</p>

<p>5 Jan 2021, 2ef16fb.</p>

</dd>
<dt id="Fix-some-incorrect-error-messages-due-to-side-comments"><b>Fix some incorrect error messages due to side comments</b></dt>
<dd>

<p>Testing with large numbers of side comments caused perltidy to produce some incorrect error messages. Two issues are fixed with this update. First, a side comment between a pointer &#39;-&gt;&#39; and the next identifier caused a message. Second, in some cases a comment after an opening paren could cause a message. The following snippet is an example.</p>

<pre><code>    $Msg#sc#
    -&gt;#sc#
    $field#sc#
    (#sc#
    )#sc#
    ;#sc#</code></pre>

<p>This update fixes cases c029 and c030.</p>

<p>4 Jul 2021, caffc2c.</p>

</dd>
<dt id="Fix-undefined-var-ref-involving---format-skipping"><b>Fix undefined var ref involving --format-skipping</b></dt>
<dd>

<p>Testing produced a situation in which version 20200625 could cause an undefined variable to be accessed (the variable &#39;Ktoken_vars&#39;) as in this snippet:</p>

<pre><code>    #!/usr/bin/perl
    #&lt;&lt;&lt;
        my $ra= (
            [ &#39;Shine&#39;, 40 ], [ &#39;Specular&#39;, [ 1, 1, 0.3, 0 ] ] );
    #&lt;&lt;&lt;
    ...</code></pre>

<p>The conditions for this to happen are:</p>

<pre><code>  (1) format skipping (#&lt;&lt;&lt;) begins before the first line of code, and
  (2) the format skipping section contains the two successive characters &#39;, [&#39;.</code></pre>

<p>The undefined variable was &#39;Ktoken_vars&#39;. This problem was introduced by commit 21ef53b, an update which fixed case b1100. This undefined variable access does influence the formatted output.</p>

<p>This update fixes this problem.</p>

<p>4 Jul 2021, 82916fe.</p>

</dd>
<dt id="Check-for-side-comment-within-package-statement"><b>Check for side comment within package statement</b></dt>
<dd>

<p>Testing with randomly placed side comments caused perltidy to produce an incorrect warning when a side comment is placed before the end of a package statement:</p>

<pre><code>    package double # side comment
    ;</code></pre>

<p>This update fixes this. 3 Jul 2021, c00059a.</p>

</dd>
<dt id="Fix-problem-with--comma-arrow-breakpoint-n-flag"><b>Fix problem with -comma-arrow-breakpoint=n flag</b></dt>
<dd>

<p>Testing revealed a formatting irregularity which was caused when the flag -cab=2 got applied to a container which was not a list. This is fixed with update, which fixes case b939a.</p>

<p>1 Jul 2021, 021b938.</p>

</dd>
<dt id="Fix-a-formatting-instability"><b>Fix a formatting instability</b></dt>
<dd>

<p>Testing showed that a previously fixed case of instability, b1144, which was fixed 21 Jun 2021, 1b682fd, was unstable again. This update is a small change which fixes this. There are no other known unstable cases at this time but automated testing runs continue to search for instabilities.</p>

<p>1 Jul 2021, 021b938.</p>

</dd>
<dt id="Fixed-use-of-uninitialized-value"><b>Fixed use of uninitialized value</b></dt>
<dd>

<p>The previous Tokenizer update caused the use of an unitialized value when run on case b1053:</p>

<pre><code> Use of uninitialized value $next_nonblank_token in pattern match (m//) at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 7589.
 Use of uninitialized value $nn_nonblank_token in pattern match (m//) at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 3723.
 b1053 converged on iteration 2</code></pre>

<p>This update fixes this.</p>

<p>1 Jul 2021, ea139bd.</p>

</dd>
<dt id="Fix-token-type-of-colon-introducing-anonomyous-sub-attribute-list"><b>Fix token type of colon introducing anonomyous sub attribute list</b></dt>
<dd>

<p>In the following example</p>

<pre><code>    print &quot;not &quot; unless ref +(
        map {
            sub : lvalue { &quot;a&quot; }
        } 1
    )[0] eq &quot;CODE&quot;;</code></pre>

<p>the colon after &#39;sub&#39; was being marked as part of a label rather than the start of an attribute list. This does not cause an error, but the space before the &#39;:&#39; is lost. This is fixed in this update.</p>

<p>Note that something like &#39;sub :&#39; can also be a label, so the tokenizer has to look ahead to decide what to do. For example, this &#39;sub :&#39; is a label:</p>

<pre><code>    my $xx = 0;
    sub : {
        $xx++;
        print &quot;looping with label sub:, a=$xx\n&quot;;
        if ( $xx &lt; 10 ) { goto &quot;sub&quot; }
    }</code></pre>

<p>In this case, the goto statement needs quotes around &quot;sub&quot; because it is a keyword.</p>

<p>29 Jun 2021, d5fb3d5.</p>

</dd>
<dt id="Minor-adjustments-to-improve-formatting-stability"><b>Minor adjustments to improve formatting stability</b></dt>
<dd>

<p>Testing with random input parameters produced several new cases of formatting instability involving unusual parameter combinations. This update fixes these cases, b1169 b1170 b1171, and all previously discovered cases remain stable with the update.</p>

<p>28 Jun 2021, e1f22e0.</p>

</dd>
<dt id="Remove-limit-on--ci-n-when--xci-is-set-see-rt-136415"><b>Remove limit on -ci=n when -xci is set, see rt #136415</b></dt>
<dd>

<p>This update undoes the update c16c5ee of 20 Feb 2021, in which the value of -ci=n was limited to the value of -i=n when -xci was set. Recent improvements in stability tolerances allow this limit to be removed.</p>

<p>28 Jun 2021, 1b3c5e9.</p>

</dd>
<dt id="Minor-optimization"><b>Minor optimization</b></dt>
<dd>

<p>Added a quick check to bypass a needless sub call.</p>

<p>26 Jan 2021, e7822df.</p>

</dd>
<dt id="Eliminate-token-variable-_LEVEL_TRUE_"><b>Eliminate token variable _LEVEL_TRUE_</b></dt>
<dd>

<p>It was possible to eliminate this token variable by changing the order of welding operations. This reduces the number of variables per token from 12 to 11.</p>

<p>26 Jun 2021, 1f4f78c.</p>

</dd>
<dt id="Eliminate-token-variable-_CONTAINER_ENVIRONMENT_"><b>Eliminate token variable _CONTAINER_ENVIRONMENT_</b></dt>
<dd>

<p>Testing with NYT_Prof shows that the number of variables per token has a direct effect on efficiency. This update reduces the number of token variables from 13 to 12, and also simplifies the coding. It was possible to compute this variable from the others, so it was redundant.</p>

<p>26 Jun 2021, 300ca1e.</p>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20210402">Issues fixed after release 20210402</h1>

<dl>

<dt id="Release-20210625"><b>Release 20210625</b></dt>
<dd>

<p>24 Jun 2021, a4ff53d.</p>

</dd>
<dt id="Adjust-tolerances-to-fix-some-unstable-edge-cases"><b>Adjust tolerances to fix some unstable edge cases</b></dt>
<dd>

<p>Testing with random input parameters produced a number of edge cases of unstable formatting which were traced to the parameter combinations which included -lp and some other unusual settings.</p>

<p>This fixes cases b1103 b1134 b1135 b1136 b1138 b1140 b1143 b1144 b1145 b1146 b1147 b1148 b1151 b1152 b1153 b1154 b1156 b1157 b1163 b1164 b1165</p>

<p>There are no other known cases of formatting instability at the present time, but testing with random input parameters will continue.</p>

<p>21 Jun 2021, 1b682fd.</p>

</dd>
<dt id="Adjust-tolerances-to-fix-some-unstable-edge-cases1"><b>Adjust tolerances to fix some unstable edge cases</b></dt>
<dd>

<p>Testing with random input parameters produced a number of edge cases of unstable formatting which were traced to the parameter combinations which included -bbxi=2 and -cab=2. A small adjustment to length tolerances was made to fix the problem.</p>

<p>This fixes cases b1137 b1149 b1150 b1155 b1158 b1159 b1160 b1161 b1166 b1167 b1168.</p>

<p>19 Jun 2021, 4d4970a.</p>

</dd>
<dt id="Added-flag--atnl---add-terminal-newline-see-git-58"><b>Added flag -atnl, --add-terminal-newline, see git #58</b></dt>
<dd>

<p>This flag, which is enabled by default, allows perltidy to terminate the last line of the output stream with a newline character, regardless of whether or not the input stream was terminated with a newline character. If this flag is negated, with <b>-natnl</b>, then perltidy will add a terminal newline to the the output stream only if the input stream is terminated with a newline.</p>

<p>Negating this flag may be useful for manipulating one-line scripts intended for use on a command line.</p>

<p>This update also removes the description of the obsolete --check-syntax flag from the man pages and help text.</p>

<p>18 Jun 2021, 6f83170.</p>

</dd>
<dt id="Allow---delete-side-comments-to-work-with--nanl"><b>Allow --delete-side-comments to work with -nanl</b></dt>
<dd>

<p>The -nanl flag (--noadd-newlines) was preventing side comments from being deleted, for example:</p>

<pre><code>    # perltidy -dsc -nanl
    calc()    # side comment</code></pre>

<p>The same issue was happening for --delete-closing-side comments. This has been fixed.</p>

<p>18 Jun 2021, dbfd802.</p>

</dd>
<dt id="Update-welding-rule-to-avoid-unstable-states"><b>Update welding rule to avoid unstable states</b></dt>
<dd>

<p>Testing with random input parameters produced a formatting instability involving an unusual parameter combination:</p>

<pre><code>    --noadd-whitespace
    --break-before-paren=3
    --continuation-indentation=8
    --delete-old-whitespace
    --line-up-parentheses
    --weld-nested-containers</code></pre>

<p>and the following code</p>

<pre><code>        if(defined$hints{family}){
            @infos=({
                     family=&gt;$hints{family},
                     socktype=&gt;$hints{socktype},
                     protocol=&gt;$hints{protocol},
            });
        }</code></pre>

<p>This update fixes the problem, case b1162.</p>

<p>18 Jun 2021, 76873ea.</p>

</dd>
<dt id="Convert-some-weld-sub-calls-to-hash-lookups"><b>Convert some weld sub calls to hash lookups</b></dt>
<dd>

<p>This is a minor optimization. These subs are eliminated: is_welded_right_at_K, is_welded_left_at_K, weld_len_right_at_K.</p>

<p>17 Jun 2021, 1691013.</p>

</dd>
<dt id="Update-LineSink.pm-to-allow-undefined-line-endings"><b>Update LineSink.pm to allow undefined line endings</b></dt>
<dd>

<p>This update is necessary to eventually prevent an unwanted terminal newline being added to a file.</p>

<p>17 Jun 2021, 2600533.</p>

</dd>
<dt id="Fix-incorrect-sub-call"><b>Fix incorrect sub call</b></dt>
<dd>

<p>This fixes an incorrect call which could cause an incorrect weld.</p>

<p>16 Jun 2021, 068a28b.</p>

</dd>
<dt id="Add---code-skipping-option-see-git-65"><b>Add --code-skipping option, see git #65</b></dt>
<dd>

<p>Added a new option &#39;--code-skipping&#39;, requested in git #65, in which code between comment lines &#39;#&lt;&lt;V&#39; and &#39;#&gt;&gt;V&#39; is passed verbatim to the output stream without error checking. It is simmilar to --format skipping but there is no error checking, and is useful for skipping an extended syntax.</p>

<p>16 Jun 2021, 99ec876.</p>

</dd>
<dt id="Handle-nested-print-format-blocks"><b>Handle nested print format blocks</b></dt>
<dd>

<p>Perltidy was producing an error at nested print format blocks, such as</p>

<pre><code>    format NEST =
    @&lt;&lt;&lt;
    {
        my $birds = &quot;birds&quot;;
        local *NEST = *BIRDS{FORMAT};
        write NEST;
        format BIRDS =
    @&lt;&lt;&lt;&lt;&lt;
    $birds;
    .
    &quot;nest&quot;
      }
    .</code></pre>

<p>It was ending the first format at the first &#39;.&#39; rather than the second &#39;.&#39; in this example. This update fixes this, issue c019.</p>

<p>13 Jun 2021.</p>

</dd>
<dt id="Allow-stacked-labels-without-spaces"><b>Allow stacked labels without spaces</b></dt>
<dd>

<p>When labels are stacked in a single line, such as</p>

<p>A:B:C:</p>

<p>the default is to space them:</p>

<p>A: B: C:</p>

<p>This update allows the spaces to be removed if desired:</p>

<p># perltidy -naws -dws A:B:C:</p>

<p>13 Jun 2021, c2a63b2</p>

</dd>
<dt id="Fix-edge-cases-of-instability-involving--wn--lp"><b>Fix edge cases of instability involving -wn -lp</b></dt>
<dd>

<p>Random testing produced some cases of instability involving -wn -lp and some unusual additional parameters. These were traced to a test for welding, and were fixed by refining a certain tolerance. This fixes cases b1141, b1142.</p>

<p>12 Jun 2021, 125494b.</p>

</dd>
<dt id="Remove-incorrect-warning-at-repeated-function-paren-call"><b>Remove incorrect warning at repeated function paren call</b></dt>
<dd>

<p>This update removes an incorrect error messagge at the construct &#39;)(&#39;. To illustrate, the following is a valid program:</p>

<pre><code>    my @words = qw(To view this email as a web page go here);
    my @subs;
    push @subs, sub { my $i=shift; $i %= @words; print &quot;$words[$i] &quot;; return $subs[0]};
    $subs[0](0)(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11);
    print &quot;\n&quot;;</code></pre>

<p>However perltidy was giving an error message at the &#39;)(&#39; combination, which is unusual in perl scripts. This update fixes this.</p>

<p>These are function call parens, so logically they should be under control of the -sfp or --space-function-parens parameter. I wrote a patch to do this, but decided not to implement it. The reason is that, as noted in the manual, subtle errors in perl scripts can occur when spaces are placed before parens. So, to avoid possible problems, the -sfp parameter will be restricted to spaces between a bareword [assumed to be a function] and a paren.</p>

<p>This update is in Tokenizer.pm and fixes case c017.</p>

<p>6 Jun 2021, 6551d65.</p>

</dd>
<dt id="Add-warning-when-lexical-sub-names-match-some-builtins"><b>Add warning when lexical sub names match some builtins</b></dt>
<dd>

<p>This update adds a warning when lexical subs have names which match some builtin names which will almost certainly cause a parsing error in the current version of perltidy. For example, the following program is valid and will run, but perltidy will produce an error.</p>

<pre><code>    use feature qw(lexical_subs);
    use warnings; no warnings &quot;experimental::lexical_subs&quot;;
    {
      my sub y { print &quot;Hello from y: $_[0]\n&quot;; }
      y(1);
    }</code></pre>

<p>6 Jun 2021, 32729fb.</p>

</dd>
<dt id="Minor-cleanups"><b>Minor cleanups</b></dt>
<dd>

<p>This update fixes a case of formatting instability recently found with random testing. It also does some minor coding cleanups.</p>

<p>This fixes case b1139.</p>

<p>5 Jun 2021, b8527ab.</p>

</dd>
<dt id="Revised-data-structures-for-welding"><b>Revised data structures for welding</b></dt>
<dd>

<p>This update replaces the data structures used for the welding option with simpler but more general structures. This cleans up the code and will simplify future coding. No formatting changes should occur with this update.</p>

<p>4 Jun 2021, 4a886c8.</p>

</dd>
<dt id="improved-treatment-of-lexical-subs"><b>improved treatment of lexical subs</b></dt>
<dd>

<p>This update improves the treatment of lexical subs. Previously they were formatted correctly but an error would have been produced if the same name was used for lexical subs defined in different blocks.</p>

<p>For example, running the previous version of perltidy on the following:</p>

<pre><code>    use feature qw(lexical_subs);
    use warnings; no warnings &quot;experimental::lexical_subs&quot;;
    {
        my sub hello { print &quot;Hello from hello1\n&quot; }
        {
            my sub hello { print &quot;Hello from hello2\n&quot; }
            hello();
        }
        hello();
    }
    {
        my sub hello { print &quot;Hello from hello3\n&quot; }
        hello();
    }</code></pre>

<p>gave the (incorrect) error message:</p>

<pre><code>    6: already saw definition of &#39;sub hello&#39; in package &#39;main&#39; at line 4
    12: already saw definition of &#39;sub hello&#39; in package &#39;main&#39; at line 6</code></pre>

<p>This update fixes that.</p>

<p>1 Jun 2021, 85ecb7a.</p>

</dd>
<dt id="add-v-string-underscores-warn-of-leading-commas"><b>add v-string underscores; warn of leading commas</b></dt>
<dd>

<p>This update cleans up a couple of open issues in the tokenizer.</p>

<p>A warning message will be produced for a list which begins with a comma:</p>

<pre><code>            my %string = (
              ,       &quot;saddr&quot;,    $stest,  &quot;daddr&quot;,
              $dtest, &quot;source&quot;,   $sname,  &quot;dest&quot;)</code></pre>

<p>This warning had been temporarily deactivated.</p>

<p>Underscores in v-strings without a leading &#39;v&#39; are now parsed correctly.</p>

<p>Several comments have been updated.</p>

<p>31 May 2021, ef44e70.</p>

</dd>
<dt id="Fix-parsing-error-at-operator-following-a-comma"><b>Fix parsing error at operator following a comma</b></dt>
<dd>

<p>The following lines are syntactically correct but some were producing a syntax error</p>

<pre><code>    print &quot;hello1\n&quot;, || print &quot;hi1\n&quot;;
    print &quot;hello2\n&quot;, &amp;&amp; print &quot;bye2\n&quot;;
    print &quot;hello3\n&quot;, or print &quot;bye3\n&quot;;
    print &quot;hello4\n&quot;, and print &quot;bye4\n&quot;;</code></pre>

<p>For example, the first line produced this message</p>

<pre><code>    1: print &quot;hello1\n&quot;, || print &quot;hi1\n&quot;;
                       - ^
    found || where term expected (previous token underlined)</code></pre>

<p>This has been fixed. This fixes case c015.</p>

<p>27 May 2021, b537a72.</p>

</dd>
<dt id="Added-optional-o-in-octal-number-definitions"><b>Added optional o in octal number definitions</b></dt>
<dd>

<p>An optional letter &#39;o&#39; or &#39;O&#39; in the octal representation of numbers, which was added in perl version 5.33.5, is now recogized. The leading zero is still required.</p>

<p>For example:</p>

<pre><code>    $a = 0o100;
    $a = 0O100;</code></pre>

<p>26 May 2021, 544df8c.</p>

</dd>
<dt id="Fix-several-problems-with--lp-formatting"><b>Fix several problems with -lp formatting</b></dt>
<dd>

<p>This update fixes several problems with -lp formatting which are all somewhat related.</p>

<p>ISSUE #1 (cases c002 and c004): A problem involving -lp -wn and certain qw lists</p>

<p>The last line of a welded qw list was being outdented even if it contained text as well as the closing container token. This update fixes the problem and simplifies the logic.</p>

<p>A few examples (all use &#39;perltidy -wn -lp&#39;):</p>

<pre><code>    # OLD and NEW: OK, closing qw paren is on separate line
    $roads-&gt;add_capacity_path( qw( CoolCity 10 ChocolateGulch 8
                               PecanPeak 10 BlueberryWoods 6
                               HotCity
    ) );

    # OLD: poor; outdented text not aligned with previous text
    $roads-&gt;add_capacity_path( qw( CoolCity 10 ChocolateGulch 8
                               PecanPeak 10 BlueberryWoods 6
    HotCity ) );

    # NEW:
    $roads-&gt;add_capacity_path( qw( CoolCity 10 ChocolateGulch 8
                               PecanPeak 10 BlueberryWoods 6
                               HotCity ) );

    # OLD:
    $roads-&gt;add_capacity_path( qw( ChocolateGulch 3 StrawberryFields 0
    StrawberryFields ) );

    # NEW:
    $roads-&gt;add_capacity_path( qw( ChocolateGulch 3 StrawberryFields 0
                               StrawberryFields ) );

    # OLD:
    my $mon_name = ( qw(January February March April
                     May June July August
    September October November December) )[$mon];

    # NEW
    my $mon_name = ( qw(January February March April
                     May June July August
                     September October November December) )[$mon];</code></pre>

<p>ISSUE #2 (case c007): A rare program error could be triggered with -lp -xci</p>

<p>In some very rare circumstances it was possible to trigger a &quot;Program error&quot; message. The program still ran to completion. The conditions for this to occur were that flags -lp -xci were set, and that there was a container of sort/map/grep blocks, and there was a side comment on the closing paren. For example:</p>

<pre><code>    # OLD: perltidy -lp -xci, gave an error message and extra indentation here
    my %specified_opts = (
          (
                          map { /^no-?(.*)$/i ? ($1 =&gt; 0) : ($_ =&gt; 1) }
                          map { /^--([\-_\w]+)$/ } @ARGV
          ),    # this comment caused an error with flags -lp -xci
    );

    # NEW: perltidy -lp -xci, no error
    my %specified_opts = (
          (
             map { /^no-?(.*)$/i ? ( $1 =&gt; 0 ) : ( $_ =&gt; 1 ) }
             map { /^--([\-_\w]+)$/ } @ARGV
          ),    # this comment caused an error with flags -lp -xci
    );</code></pre>

<p>ISSUE #3 (case c008): In some unusual cases the -lp formatting style was not being applied when it should have been. For example (text is shifted right):</p>

<pre><code>    # NEW: perltidy -lp
    $result = runperl(
        switches =&gt; [ &#39;-I.&#39;, &quot;-w&quot; ],
        stderr   =&gt; 1,
        prog     =&gt; &lt;&lt;&#39;PROG&#39; );
    SIG
    PROG

    # NEW: perltidy -lp
    $result = runperl(
                       switches =&gt; [ &#39;-I.&#39;, &quot;-w&quot; ],
                       stderr   =&gt; 1,
                       prog     =&gt; &lt;&lt;&#39;PROG&#39; );
    SIG
    PROG</code></pre>

<p>25 May 2021, 6947fe9.</p>

</dd>
<dt id="Modify-welding-rules"><b>Modify welding rules</b></dt>
<dd>

<p>This is an update to the patch 19 Apr 2021, eeeaf09. It restricts that patch to -lp formatting mode.</p>

<p>This fixes case b1131.</p>

<p>21 May 2021, a4ec4c1.</p>

</dd>
<dt id="Fix-inconsistency-involving-counting-commas"><b>Fix inconsistency involving counting commas</b></dt>
<dd>

<p>Random testing produced a formatting instability involving the combination of flags -bbp=2 -xci -vt=2 -bvtc=2. The problem was traced to an error in counting the number of line ending commas in lists.</p>

<p>This fixes case b1130.</p>

<p>15 May 2021, 90cceb1.</p>

</dd>
<dt id="Slightly-modify-line-breaks-for--lp-indentation"><b>Slightly modify line breaks for -lp indentation</b></dt>
<dd>

<p>Random testing produced an edge case of formatting instability for -lp indentation which was traced to checking for an old line break at a &#39;=&gt;&#39;. This has been fixed. Some existing formatting with deeply nested structures may be slightly changed due to the fix, but most existing formatting will be unchanged.</p>

<p>This fixes b1035.</p>

<p>15 May 2021, dd42648.</p>

</dd>
<dt id="Rewrite-coding-for--bom-flag"><b>Rewrite coding for -bom flag</b></dt>
<dd>

<p>Random testing produced some examples of formatting instability involving the -bom flag in combination with certain other flags which are fixed with this update. As part of this update, a previous update to fix case b977 (21 Feb 2021, commit 28114e9) was revised to use a better criterion for deciding when not to keep a &#39;)-&gt;&#39; break. The previous criterion was that the opening and closing containers should be separated by more than one line. The new criterion is that they should contain a list. This still fixes case b977. Another case, b1120, was fixed by requiring that only parentheses expressions be considered for keeping a line break, not &#39;}-&gt;&#39; or &#39;]-&gt;&#39;.</p>

<p>Some issues are illustrated in the following examples using &#39;-bom -gnu&#39;. In the first example the leading &#39;)-&gt;&#39; was being lost due to the old b977 fix:</p>

<pre><code>    # input:
    $show = $top-&gt;Entry( &#39;-width&#39; =&gt; 20,
                       )-&gt;pack(&#39;-side&#39; =&gt; &#39;left&#39;);

    # OLD: perltidy -gnu -bom
    $show = $top-&gt;Entry(&#39;-width&#39; =&gt; 20,)-&gt;pack(&#39;-side&#39; =&gt; &#39;left&#39;);

    # NEW: perltidy -gnu -bom
    $show = $top-&gt;Entry(
                        &#39;-width&#39; =&gt; 20,
                       )-&gt;pack(&#39;-side&#39; =&gt; &#39;left&#39;);</code></pre>

<p>In the following example a leading &#39;-&gt;&#39; was being lost. The NEW version keeps the leading &#39;-&gt;&#39; but has to give up on the -lp alignment because of complexity:</p>

<pre><code>        # input
        $_make_phase_arg = join(&quot; &quot;,
                           map {CPAN::HandleConfig
                                 -&gt;safe_quote($_)} @{$prefs-&gt;{$phase}{args}},
                          );

        # OLD: perltidy -gnu -bom
        $_make_phase_arg = join(&quot; &quot;,
                                map { CPAN::HandleConfig-&gt;safe_quote($_) }
                                  @{$prefs-&gt;{$phase}{args}},
                               );

        # NEW: perltidy -gnu -bom
        $_make_phase_arg = join(
            &quot; &quot;,
            map {
                CPAN::HandleConfig
                  -&gt;safe_quote($_)
            } @{$prefs-&gt;{$phase}{args}},
        );</code></pre>

<p>In the following example, a leading &#39;)-&gt;&#39; was being converted to a leading &#39;-&gt;&#39; due to the old b977 fix:</p>

<pre><code>    # Starting script
    $lb = $t-&gt;Scrolled(&quot;Listbox&quot;, -scrollbars =&gt; &quot;osoe&quot;
                      )-&gt;pack(-fill =&gt; &quot;both&quot;, -expand =&gt; 1);

    # OLD: perltidy -bom -gnu
    $lb = $t-&gt;Scrolled( &quot;Listbox&quot;, -scrollbars =&gt; &quot;osoe&quot; )
      -&gt;pack( -fill =&gt; &quot;both&quot;, -expand =&gt; 1 );

    # NEW: perltidy -bom -gnu
    $lb = $t-&gt;Scrolled(
                       &quot;Listbox&quot;, -scrollbars =&gt; &quot;osoe&quot;
                      )-&gt;pack(-fill =&gt; &quot;both&quot;, -expand =&gt; 1);</code></pre>

<p>In the following example, a leading &#39;)-&gt;&#39; was being lost, again due to the old b977 fix:</p>

<pre><code>    $myDiag-&gt;Label(-text =&gt; $text,
                                  )-&gt;pack(-fill =&gt; &#39;x&#39;,
                                                  -padx =&gt; 3,
                                                  -pady =&gt; 3);

    # OLD: -gnu -bom
    $myDiag-&gt;Label(-text =&gt; $text,)-&gt;pack(
                                          -fill =&gt; &#39;x&#39;,
                                          -padx =&gt; 3,
                                          -pady =&gt; 3
                                         );

    # NEW -gnu -bom
    $myDiag-&gt;Label(
                   -text =&gt; $text,
      )-&gt;pack(
              -fill =&gt; &#39;x&#39;,
              -padx =&gt; 3,
              -pady =&gt; 3
             );</code></pre>

<p>This update fixes case b1120 and revises the fix for b977.</p>

<p>13 May 2021, d0ac5e9.</p>

</dd>
<dt id="Adjust-tolerances-for-some-line-length-tests"><b>Adjust tolerances for some line length tests</b></dt>
<dd>

<p>Random testing produced some edge cases of unstable formatting involving the -lp format. These were fixed by using a slightly larger tolerance in the length test for containers which were broken in the input file.</p>

<p>This fixes cases b1059 b1063 b1117.</p>

<p>13 May 2021, 24a11d3.</p>

</dd>
<dt id="Do-not-apply--lp-formatting-to-containers-with-here-doc-text"><b>Do not apply -lp formatting to containers with here-doc text</b></dt>
<dd>

<p>If a container contains text of a here-doc then the indentation is fixed by the here-doc text, so applying -lp formatting does not work well. So this update turns off the -lp formatting in this case.</p>

<p>But note that if a container contains a here target but not the here text so it still gets the -lp indentation:</p>

<pre><code>    # perltidy -lp
    &amp;WH::Spell::AddSpell(
                          &quot;Cause Light Wounds&quot;, &quot;WFP&quot;,
                          &quot;CauseLightWounds&quot;,   &lt;&lt;&#39;EOH&#39;);
    ...
    EOH</code></pre>

<p>This fixes case b1081.</p>

<p>10 May 2021, 4f7a56b.</p>

</dd>
<dt id="Fix-some-edge-welding-cases"><b>Fix some edge welding cases</b></dt>
<dd>

<p>Some adjustments in welding coding was made to maintain stability for some unusual parameter combinations.</p>

<p>This fixes cases b1111 b1112.</p>

<p>9 May 2021, 68f619a.</p>

</dd>
<dt id="Improve-tolerance-for-welding-qw-quotes"><b>Improve tolerance for welding qw quotes</b></dt>
<dd>

<p>The tolerance for welding qw quotes has been update to be the same as used for welding other tokens. This fixes case b1129.</p>

<p>9 May 2021, d1de85f.</p>

</dd>
<dt id="Revise-weld-tolerances-simplify-code-fix-welded-ci"><b>Revise weld tolerances, simplify code, fix welded ci</b></dt>
<dd>

<p>The welding process uses a tolerance to keep results stable. Basically, a zero tolerance is used if it looks like it is welding an existing weld, while a finite tolerance is used otherwise. The effect is to reject a few marginal welds to gain stability. The coding to do this was simplified and the tolerance was made more precise to fix case b1124.</p>

<p>Another change with this update is that at welded containers, the value of the -ci flag of an outer opening token is transferred to the inner opening token. This may improve some indentation in a few cases if the -lp flag is also used. It has no effect if -lp is not used.</p>

<pre><code>    # OLD: perltidy -wn -gnu
    emit_symbols([qw(
     ctermid
     get_sysinfo
     Perl_OS2_init
     ...
     CroakWinError
    )]);

    # NEW: perltidy -wn -gnu
    emit_symbols([qw(
        ctermid
        get_sysinfo
        Perl_OS2_init
        ...
        CroakWinError
    )]);</code></pre>

<p>9 May 2021, ad8870b.</p>

</dd>
<dt id="Correct-brace-types-mismarked-by-tokenizer-update"><b>Correct brace types mismarked by tokenizer, update</b></dt>
<dd>

<p>This is a generalization of commit 7d3bf4 in which the tokenizer sends a signal to the formatter if the type of a brace following an unknown bareword had to be guessed. The formatter has more information and can fix the problem. This fixes case b1128.</p>

<p>8 May 2021, b3eaf23.</p>

</dd>
<dt id="Added-warning-when--ci-has-to-be-reduced-ref-rt-136415"><b>Added warning when -ci has to be reduced; ref rt #136415</b></dt>
<dd>

<p>In commit c16c5ee an update was made to prevent instability with -xci when the value of -ci exceeds -i (which is not recommended). This update adds a warning message to avoid confusing the user.</p>

<p>7 May 2021, e9e14e4.</p>

</dd>
<dt id="Improve-indentation-of-welded-multiline-qw-quotes"><b>Improve indentation of welded multiline qw quotes</b></dt>
<dd>

<p>Formatting of multiline qw lists with welding works best if the opening and closing qw tokens are on separate lines, like this:</p>

<pre><code>    # perltidy -wn
    my $mon_name = ( qw(
        January February March April
        May June July August
        September October November December
    ) )[$mon];

    # perltidy -wn -lp
    my $mon_name = ( qw(
                     January February March April
                     May June July August
                     September October November December
    ) )[$mon];</code></pre>

<p>Otherwise formatting can be poor, particularly if the last line has text and a closing container.</p>

<pre><code>    # OLD: perltidy -wn
    my $mon_name = ( qw(January February March April
        May June July August
    September October November December) )[$mon];</code></pre>

<p>Note that perltidy does not change the line breaks within multiline quotes, so they must be changed by hand if desired.</p>

<p>This update indents the last line of a multiline quote which contains both text and the closing token, such as:</p>

<pre><code>    # NEW: perltidy -wn
    my $mon_name = ( qw(January February March April
        May June July August
        September October November December) )[$mon];</code></pre>

<p>This update is only when the -lp flag is not used. If -lp is used and the last line contains text, the last line is still outdented:</p>

<pre><code>    $ OLD and NEW: perltidy -wn -lp
    my $mon_name = ( qw(January February March April
                     May June July August
    September October November December) )[$mon];</code></pre>

<p>This is difficult to fix. The best solution is to place the closing qw qw containers on a separate line.</p>

<p>This fix is for case c002.</p>

<p>6 May 2021, 176f8a7.</p>

</dd>
<dt id="Test-length-of-closing-multiline-qw-quote-before-welding"><b>Test length of closing multiline qw quote before welding</b></dt>
<dd>

<p>Random testing produced an unstable state which was due to not checking for excessive length of the last line of a multiline qw quote. A check was added, this fixes issue b1039.</p>

<p>5 May 2021, b72ad24.</p>

</dd>
<dt id="Update-welding-rule-to-avoid-blinking-states"><b>Update welding rule to avoid blinking states</b></dt>
<dd>

<p>Random testing with unusual parameter combinations produced some unstable welds. For example case b1106 has these parameters</p>

<pre><code>    --noadd-whitespace
    --continuation-indentation=6
    --delete-old-whitespace
    --line-up-parentheses
    --maximum-line-length=36
    --variable-maximum-line-length
    --weld-nested-containers</code></pre>

<p>and was switching between these two states:</p>

<pre><code>            return map{
                ($_,[$self-&gt;$_(@_[1..$#_])])
            }@every;

            return map { (
                $_, [ $self-&gt;$_( @_[ 1 .. $#_ ] ) ]
            ) } @every;</code></pre>

<p>An existing rule, WELD RULE 2, was updated to prevent welding to an intact one-line weld, as in the first snippet, if it is on a separate line from the first opening token. With this change, both of these states are stable.</p>

<p>This update fixes cases b1082 b1102 b1106 b1115.</p>

<p>4 May 2021, 07efa9d.</p>

</dd>
<dt id="Fix-problem-of-conflict-of--otr-and--lp"><b>Fix problem of conflict of -otr and -lp</b></dt>
<dd>

<p>Several random test cases produced an instability involving -otr and -lp. In -lp mode, when an opening paren follows an equals and is far to the right, a break is made at the equals to minimize the indentation of the next lines. The -otr flag is a suggestion that an opening paren should be place on the right. A check has been made to avoid this in -lp mode following an equals, since that defeats the purpose of the original break.</p>

<p>This fixes cases b964 b1040 b1062 b1083 b1089.</p>

<p>4 May 2021, 24a0d32.</p>

</dd>
<dt id="Add-option--pvtc-3-requested-in-rt136417"><b>Add option -pvtc=3, requested in rt136417</b></dt>
<dd>

<p>A new integer option, n=3, has been added to the vertical tightness closing flags. For a container with n=3, the closing token will behave as for n=0 if the opening token is preceded by an &#39;=&#39; or &#39;=&gt;&#39;, and like n=1 otherwise.</p>

<p>3 May 2021, 93063a7.</p>

</dd>
<dt id="Fix-vertical-alignment-issue-in-rt136416"><b>Fix vertical alignment issue in rt136416</b></dt>
<dd>

<p>This update fixes a problem with unwanted vertical alignment rasied in rt#136416. The example is</p>

<pre><code>    use File::Spec::Functions &#39;catfile&#39;, &#39;catdir&#39;;
    use Mojo::Base &#39;Mojolicious&#39;,        &#39;-signatures&#39;;</code></pre>

<p>An update was made to reject alignments in use statements with different module names. The test file t/snippets/align35.in has more examples.</p>

<p>3 May 2021, 048126c.</p>

</dd>
<dt id="Fix-some-rare-issues-with-the--lp-option"><b>Fix some rare issues with the -lp option</b></dt>
<dd>

<p>Random testing produced some rare cases of unstable formatting involving the <b>-lp</b> option which are fixed with this update. This is a generalization of commit edc7878 of 23 Jan 2021. This fixes cases b1109 b1110.</p>

<p>2 May 2021, a8d1c8b.</p>

</dd>
<dt id="Correct-brace-types-mismarked-by-tokenizer"><b>Correct brace types mismarked by tokenizer</b></dt>
<dd>

<p>This is a generalization of commit 7d23bf4 to fix some additional cases found in random testing in which the type of a curly brace could not be determined in the tokenizer and was not being corrected by the formatter.</p>

<p>This fixes cases b1125 b1126 b1127.</p>

<p>2 May 2021, dac97cb.</p>

</dd>
<dt id="Avoid-instability-of-combination--bbx-2--lp-and--xci"><b>Avoid instability of combination -bbx=2 -lp and -xci</b></dt>
<dd>

<p>Random testing produced several cases in which the flags -bbx=2 -lp and -xci were causing formatting instability. The fix is to locally turn off -xci when -lp and -bbx=2 are in effect. This is an extension of commit 2b05051.</p>

<p>This fixes cases b1090 b1095 b1101 b1116 b1118 b1121 b1122 b1099</p>

<p>1 May 2021, 4cb81ba.</p>

</dd>
<dt id="Restrict-use-of-flag--cab-3-to-simple-structures"><b>Restrict use of flag -cab=3 to simple structures</b></dt>
<dd>

<p>Logic was added to turn off -cab=3 in complex structures. Otherwise, instability can occur. When it is overridden the behavior of the closest match, -cab=2, is used instead.</p>

<p>For example, using these parameters for case b1113</p>

<pre><code>    --noadd-whitespace
    --break-before-hash-brace-and-indent=2
    --break-before-hash-brace=1
    --comma-arrow-breakpoints=3
    --continuation-indentation=9
    --maximum-line-length=76
    --variable-maximum-line-length</code></pre>

<p>formatting of the following snippet was unstable:</p>

<pre><code>    $STYLESHEET{&#39;html-light&#39;}={
        &#39;tags&#39;=&gt;{
            &#39;predefined identifier&#39;=&gt;
                     {
                &#39;start&#39;=&gt;&#39;&lt;font color=&quot;#2040a0&quot;&gt;&lt;strong&gt;&#39;,
                &#39;stop&#39;=&gt;&#39;&lt;/strong&gt;&lt;/font&gt;&#39;
                     },
        }
    };</code></pre>

<p>This update fixes cases b1096 b1113.</p>

<p>29 Apr 2021, 32a1830.</p>

</dd>
<dt id="Update-docs-for-git-64-regarding--lp-and-side-comments"><b>Update docs for git #64 regarding -lp and side comments</b></dt>
<dd>

<p>The wording regarding when -lp reverts to the default indentation scheme has been revised to include side comment as follows:</p>

<p>In situations where perltidy does not have complete freedom to choose line breaks it may temporarily revert to its default indentation method. This can occur for example if there are blank lines, block comments, multi-line quotes, or side comments between the opening and closing parens, braces, or brackets.</p>

<p>The word &#39;may&#39; is significant for side comments. In a list which is just one level deep side comments will work (perhaps with -iscl if side comments are long). For example this is ok</p>

<pre><code>    # perltidy -lp
    $gif-&gt;arc(
               50, 50,     # Center x, y.
               30, 30,     # Width, Height.
               0,  360,    # Start Angle, End Angle.
               $red
    );</code></pre>

<p>But if a list is more than one level deep then the default indentation is used.</p>

<p>28 Apr 2021, 49977b8.</p>

</dd>
<dt id="Fix-line-break-rules-for-uncontained-commas-cleanups"><b>Fix line break rules for uncontained commas + cleanups</b></dt>
<dd>

<p>This is an adjustment of update 344519e which had to do with breaking lines with commas which were not inside of a container. In a few cases it was producing very long lines when <b>-l=0</b> was set. The solution was to remove the concatenation operator from the list of operators at which breaks were prevented.</p>

<p>Other updates are: Remove unused indentation table. Correct maximum_line_length table for -vmll when -wc is also set. Also fix whitespace rule for &#39;$ =&#39; within a signature to fix case b1123.</p>

<p>26 Apr 2021, d014c2a.</p>

</dd>
<dt id="Fix-problem-with--wn-and--wc-n"><b>Fix problem with -wn and -wc=n</b></dt>
<dd>

<p>Random testing produced some cases in which the -wn flag was unstable when -wc=n was used with very small n. This has been fixed.</p>

<p>This fixes cases: b1098 b1107 25 Apr 2021, 92babdf.</p>

</dd>
<dt id="Adjust-line-break-rules-for-uncontained-commas"><b>Adjust line break rules for uncontained commas</b></dt>
<dd>

<p>Random testing produced case c1119 which was unstable due to the formatting rules for breaking lines at commas which occur outside of containers. The rules were modified to fix the problem.</p>

<p>20 Apr 2021, 344519e.</p>

</dd>
<dt id="Fix-a-bad-line-break-choice-at-a-slash"><b>Fix a bad line break choice at a slash</b></dt>
<dd>

<p>Random testing produced case c001 in which the following snipppet</p>

<pre><code>   ok $mi/(@mtime-1) &gt;= 0.75 &amp;&amp; $ai/(@atime-1) &gt;= 0.75 &amp;&amp;
             $ss/(@mtime+@atime) &gt;= 0.2;</code></pre>

<p>when processed with these parameters</p>

<pre><code>    --maximum-line-length=20
    --nowant-right-space=&#39; / &#39;
    --want-break-before=&#39;* /&#39;</code></pre>

<p>produced the following result</p>

<pre><code>    ok $mi
      /( @mtime - 1 ) &gt;=
      0.75
      &amp;&amp; $ai
      /( @atime - 1 )
      &gt;= 0.75
      &amp;&amp; $ss
      /( @mtime +
          @atime ) &gt;=
      0.2;</code></pre>

<p>using &#39;perl -cw&#39; on this snippet gives a syntax error</p>

<pre><code>    syntax error at /tmp/issues.t line 5, near &quot;/( &quot;
        (Might be a runaway multi-line // string starting on line 2)</code></pre>

<p>The error is due to perl&#39;s weird parsing rules near a possible indrect object. This is a situation where perltidy must ignore a user spacing and line break request. This should have been done but in this case a flag to prevent this was not being propagated to later stages of formatting. This has been fixed.</p>

<p>20 Apr 2021, 4fbc69a.</p>

</dd>
<dt id="Fix-rare-problem-with--lp--wn"><b>Fix rare problem with -lp -wn</b></dt>
<dd>

<p>Random testing produced case b1114 which gave unstable formatting with these parameters</p>

<pre><code>    --noadd-whitespace
    --indent-columns=8
    --line-up-parentheses
    --maximum-line-length=25
    --weld-nested-containers</code></pre>

<p>and this snippet</p>

<pre><code>    is(length(pack(&quot;j&quot;, 0)),
        $Config{ivsize});</code></pre>

<p>Fixed 19 Apr 2021, eeeaf09.</p>

</dd>
<dt id="Fix-issue-git-63"><b>Fix issue git#63</b></dt>
<dd>

<p>The following lines produced an error message due to the side comment</p>

<pre><code>    my $fragment = $parser-&gt;    #parse_html_string
      parse_balanced_chunk($I);</code></pre>

<p>Fixed 18 Apr 2021, c2030cf.</p>

</dd>
<dt id="Avoid-welding-at-sort-map-grep-paren-calls"><b>Avoid welding at sort/map/grep paren calls</b></dt>
<dd>

<p>Random testing produced several cases of unstable welds in which the inner container something like &#39;sort (&#39;. The problem was that there are special rules which prevent a break following such a paren. The problem was fixed by preventing welds at these locations.</p>

<p>This update fixes cases b1077 b1092 b1093 b1094 b1104 b1105 b1108.</p>

<p>17 Apr 2021, d679b48.</p>

</dd>
<dt id="Fix-issue-git-62"><b>Fix issue git#62</b></dt>
<dd>

<p>This fixes issue git #62. A similar issue for the % operator was fixed. 17 Apr 2021, f80d677.</p>

</dd>
<dt id="Fix-problem-involving--bbx-2--xci--osbr-and-similar--otr-flags"><b>Fix problem involving -bbx=2 -xci -osbr and similar -otr flags</b></dt>
<dd>

<p>Random testing produced case b1100 in which the output style produced by the --opening-token-right flags interfered with counting line-ending commas, and this in turn caused the -bbx flag to turn off the -xci flag. This problem was fixed.</p>

<p>15 Apr 2021, 21ef53b.</p>

</dd>
<dt id="Fix-rare-line-break-problem"><b>Fix rare line break problem</b></dt>
<dd>

<p>Random testing produced case b1097 with this parameter set</p>

<pre><code>    --brace-vertical-tightness-closing=1
    --continuation-indentation=8
    --indent-columns=10
    --maximum-line-length=36</code></pre>

<p>and either this output</p>

<pre><code>          my (@files) = @{
                    $args{-files} };</code></pre>

<p>or this output</p>

<pre><code>          my (@files) =
                  @{ $args{-files}
                  };</code></pre>

<p>The different results were caused by the unusual combination of parameters. The problem was fixed by not allowing the formatter to consider existing breaks at highly stressed locations such as these.</p>

<p>15 Apr 2021, 9f15b9d.</p>

</dd>
<dt id="Fix-problem-parsing-anonymous-subs-with-attribute-lists"><b>Fix problem parsing anonymous subs with attribute lists</b></dt>
<dd>

<p>Random testing produced case b994 with unstable formatting:</p>

<pre><code>    do
    sub :
    lvalue
    {
    return;
    }</code></pre>

<p>when run with parameters:</p>

<pre><code>    --continuation-indentation=0
    --ignore-old-breakpoints
    --maximum-line-length=7
    --opening-anonymous-sub-brace-on-new-line</code></pre>

<p>The line &#39;sub :&#39; was being correctly parsed but the following opening block brace was not correctly marked as an anonymous sub brace. This fixes cases b994 and b1053.</p>

<p>15 Apr 2021, 84c1123.</p>

</dd>
<dt id="Correct-brace-types-mismarked-by-tokenizer1"><b>Correct brace types mismarked by tokenizer</b></dt>
<dd>

<p>Testing with random parameters produced a case in which a brace following an unknown bareword was marked by the tokenizer as a code block brace rather than a hash brace. This can cause poor formatting. The problem was solved by having the tokenizer send a signal to the formatter if a block type was guessed. The formatter has more information and can fix the problem. This fixes case b1085.</p>

<p>11 Apr 2021, 7d23bf4.</p>

</dd>
<dt id="Unify-coding-for-welded-quotes-and-other-welded-containers"><b>Unify coding for welded quotes and other welded containers</b></dt>
<dd>

<p>Random testing produced some cases where welded quotes were not converging. These were found to be due to the same problem previouly encountered and fixed for normal containers. The problem was fixed by moving the corrected coding to a new common sub.</p>

<p>This update fixes cases b1066 b1067 b1071 b1079 b1080.</p>

<p>10 Apr 2021, 5d73dd5.</p>

</dd>
<dt id="Slight-change-in-weld-length-calculation"><b>Slight change in weld length calculation</b></dt>
<dd>

<p>Random testing produced some cases of instability with some unusual input parameter combinations involving the -wn parameter. This was fixed by revising a line length calculation. This fixes cases b604 and b605.</p>

<p>9 Apr 2021, a25cfaa.</p>

</dd>
<dt id="Improve-treatment-of--vmll-with--wn"><b>Improve treatment of -vmll with -wn</b></dt>
<dd>

<p>Random testing showed a weakness in the treatment of the -vmll flag in combination with the -wn flag. This has been fixed.</p>

<p>This fixes cases b866 b1074 b1075 b1084 b1086 b1087 b1088</p>

<p>8 Apr 2021, a6effa3.</p>

</dd>
<dt id="Merge-weld-rule-6-into-rule-3"><b>Merge weld rule 6 into rule 3</b></dt>
<dd>

<p>One of the welding rules, RULE 6, has been merged into RULE 3 for generality. This rule restricts welding to an opening container followed by a bare word, which can cause instability in some cases. The updated code is less restrictive and fixes some cases recently found with random testing, b1078 b1091.</p>

<p>8 Apr 2021, f28ab55.</p>

</dd>
<dt id="Moved-logic-of-previous-update-to-the-FileWriter-module"><b>Moved logic of previous update to the FileWriter module</b></dt>
<dd>

<p>The previous update regarding blank line generation was not sufficiently general to handle all possible parameter combinations. The problem was solved and simplified by moving the logic to a lower level, in the FileWriter module.</p>

<p>6 Apr 2021, 756e930.</p>

</dd>
<dt id="Fix-problem-with-excess-blank-line-generation-with--blao"><b>Fix problem with excess blank line generation with -blao</b></dt>
<dd>

<p>Random testing produced some cases where excess blank lines could be generated with the parameter -blank-lines-after-opening-block. Case b1073 has the following script</p>

<pre><code>    sub stop {

        1;
    }</code></pre>

<p>and the following parameters</p>

<pre><code>    --blank-lines-after-opening-block=2
    --maximum-consecutive-blank-lines=10
    --maximum-line-length=15</code></pre>

<p>When run, blank lines keep getting generated until the maximum is reached. This has been fixed.</p>

<p>6 Apr 2021, 9216298.</p>

</dd>
<dt id="Fix-edge-case-involving--wn-and--lp-or--bbao"><b>Fix edge case involving -wn and -lp or -bbao</b></dt>
<dd>

<p>A change was made to a welding rule involving the -lp option or -wbb=&#39;=&#39;, and very short maximum line lengths. This correctly fixes case b1041. It replaces a fix for this case reported on 2 Apr 2021.</p>

<p>5 Apr 2021.</p>

</dd>
<dt id="Modify-a-condition-for-applying--bbx-2"><b>Modify a condition for applying -bbx=2</b></dt>
<dd>

<p>Random testing produced some edge cases in which formatting with the -bbx=2 flags, in combination with certain other parameters, was not converging. An existing criterion for the -bbx=2 flag to apply is that there be a broken sub-list with at least one line-ending comma. This was updated to also require either a fat comma or one additional line-ending comma. This filters out some problem cases without changing much existing formatting.</p>

<p>This update fixes cases b1068 b1069 b1070 b1072 b1073 b1076.</p>

<p>5 Apr 2021, 16c4591.</p>

</dd>
<dt id="Improve-previous--wn-update"><b>Improve previous -wn update</b></dt>
<dd>

<p>The previous update produced some problems in testing which are corrected with this update.</p>

<p>5 Apr 2021, ffef089.</p>

</dd>
<dt id="Fix-rare-convergence-problem-with--wn"><b>Fix rare convergence problem with -wn</b></dt>
<dd>

<p>Random testing produced some cases in which unusual parameter combinations caused lack of convergence for the -wn flag. The problem was fixed by adjusting a tolerance in the line length calculation.</p>

<p>This fixes cases b1041 b1055.</p>

<p>2 Apr 2021, a8b6259.</p>

</dd>
<dt id="Avoid-conflict-of--bli-and--xci"><b>Avoid conflict of -bli and -xci</b></dt>
<dd>

<p>Random testing produced a case with the combination -bli and -xci which did not converge. This was fixed by turning off -xci for braces under -bli control.</p>

<p>This fixes case b1065.</p>

<p>2 Apr 2021, d20ea80.</p>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20210111">Issues fixed after release 20210111</h1>

<dl>

<dt id="Avoid-conflict-of--bbp-2-and--xci"><b>Avoid conflict of -bbp=2 and -xci</b></dt>
<dd>

<p>Random testing produced a number of cases of unstable formatting when both -xci and -bbp=2 or similar flags were set. The problem was that -xci can cause one-line blocks to break open, causing the -bbp=2 flag to continually switch formatting. The problem is fixed by locally turning off -xci at containers which do not themselves contain broken containers.</p>

<p>This fixes cases b1033 b1036 b1037 b1038 b1042 b1043 b1044 b1045 b1046 b1047 b1051 b1052 b1061.</p>

<p>30 Mar 2021, 2b05051.</p>

</dd>
<dt id="Fix-rule-for-welding-with-barewords"><b>Fix rule for welding with barewords</b></dt>
<dd>

<p>Random testing produced a case which was not converging due to a rule which avoids welding when a bareword follows. The rule was modified to allow an exception for an existing one-line weld. A non-fatal typo was also discovered and fixed.</p>

<p>This fixes cases b1057 b1064.</p>

<p>29 Mar 2021, d677082.</p>

</dd>
<dt id="Fix-conflict-between--wba-and--opr"><b>Fix conflict between -wba=&#39;||&#39; and -opr</b></dt>
<dd>

<p>Random testing produced a problem with convergence due to a conflict between two parameters for the following code</p>

<pre><code>    my $lxy =
      ( @$cx - @$cy ) ||
      (
        length ( int ( $cx-&gt;[-1] ) ) -
        length ( int ( $cy-&gt;[-1] ) ) );</code></pre>

<p>when using these parameters</p>

<pre><code>    --break-after-all-operators
    --maximum-line-length=61
    --opening-paren-right</code></pre>

<p>Both the &#39;||&#39; and the &#39;(&#39; want to be at the end of a line according to the parameters. The problem is resolved by giving priority to the &#39;||&#39;. This fixes case b1060.</p>

<p>29 Mar 2021, 6921a7d.</p>

</dd>
<dt id="Follow-user-requests-better-to-break-before-operators"><b>Follow user requests better to break before operators</b></dt>
<dd>

<p>Random testing produced some cases in which user requests to break before selected operators were not being followed. For example</p>

<pre><code>    # OLD: perltidy -wbb=&#39;.=&#39;
    $value .=
      ( grep /\s/, ( $value, $next ) )
      ? &quot; $next&quot;
      : $next;

    # FIXED: perltidy -wbb=&#39;.=&#39;
    $value
      .= ( grep /\s/, ( $value, $next ) )
      ? &quot; $next&quot;
      : $next;</code></pre>

<p>This fixes case b1054.</p>

<p>28 Mar 2021, 94f0877.</p>

</dd>
<dt id="Fix-problems-with-combinations-of--iob--lp"><b>Fix problems with combinations of -iob -lp</b></dt>
<dd>

<p>This is an correction to the update of 13 Mar 2021, 71adc77. Random testing produced several additional problems with convergence involving the combination -iob -lp. This update fixes the problem by overriding -iob at some breakpoins which are essential to the -lp parameter.</p>

<p>This update fixes these old cases: b1021 b1023</p>

<p>and these new cases: b1034 b1048 b1049 b1050 b1056 b1058</p>

<p>27 Mar 2021, cc94623.</p>

</dd>
<dt id="Add-flag--lpxl-s-to-provide-control-over--lp-formatting"><b>Add flag -lpxl=s to provide control over -lp formatting</b></dt>
<dd>

<p>The flag -lpxl=s provides control over which containers get -lp formatting. A shortcut flag -lfp is also added for limiting -lp to simple function calls.</p>

<p>Updated 25 Mar 2021, bfc00fp.</p>

</dd>
<dt id="Fix-error-message-for-multiple-conflicting-specifications-in--wnxl"><b>Fix error message for multiple conflicting specifications in -wnxl</b></dt>
<dd>

<p>There was an error in the coding for an error message which checks for conflicting requests in the -wnxl parameter.</p>

<p>Fixed 21 Mar 2021, 2ef97a2.</p>

</dd>
<dt id="Fix-issue-git-57-Warn_count-was-not-initialized"><b>Fix issue git #57, Warn_count was not initialized</b></dt>
<dd>

<p>This update fixes issue git #57, in which a warning flag was not getting zeroed on each new call to perltidy.</p>

<p>19 Mar 2021, b6d296a.</p>

</dd>
<dt id="Fix-rare-problem-with-combination--lp--wn--naws"><b>Fix rare problem with combination -lp -wn -naws</b></dt>
<dd>

<p>This update fixes case b1032 by includeing lines starting with &#39;if&#39;, &#39;or&#39;, and || among the stable breakpoints for welding when -lp -naws flags are also set.</p>

<p>This update also modifies update 7a6be43 of 16 Mar 2021 to exclude list items when checking token lengths. This reduces changes to existing formatting while still fixing the problem in case b1031.</p>

<p>18 Mar 2021, 6200034.</p>

</dd>
<dt id="Fix-definition-of-list-within-list-for--bbx-flags"><b>Fix definition of list within list for -bbx flags</b></dt>
<dd>

<p>Testing produced a blinking state involving a -bbx=2 flag with an unusual combination of other parameters. The problem was traced to the definition of a list containing another list being too restrictive. This update fixes case 1024.</p>

<p>17 Mar 2021, 7f5da0a.</p>

</dd>
<dt id="Fix-problem-with--xci-and-long-tokens"><b>Fix problem with -xci and long tokens</b></dt>
<dd>

<p>Testing produced an unstable situation involving the -xci flag and tokens which exceed the maximum line length. This fix identifies this situation and locally deactivates the -xci flag. This fixes case b1031.</p>

<p>16 Mar 2021, 7a6be43.</p>

</dd>
<dt id="Fix-error-in-parsing-use-statement-curly-brace"><b>Fix error in parsing use statement curly brace</b></dt>
<dd>

<p>Testing with random parameters produced some cases where the -xci option was not producing stable results when the maximum line length was set to a very small value. The problem was traced to the tokenizer misparsing a hash brace of a use statement as a code block type. This influences the value of continuation indentation within the braces. The problem was fixed.</p>

<p>This fixes cases b1022 b1025 b1026 b1027 b1028 b1029 b1030</p>

<p>16 Mar 2021, 6371be2.</p>

</dd>
<dt id="Fix-problems-with-combinations-of--iob--lp--wn--dws--naws"><b>Fix problems with combinations of -iob -lp -wn -dws -naws</b></dt>
<dd>

<p>Testing with random parameters produced some situation where the parameter -iob interfered with convergence when parameters -lp and/or -wn were also set. The combination -wn -lp -dws -naws also produced some non-converging states in testing. This update fixes these issues.</p>

<p>The following cases are fixed: b1019 b1020 b1021 b1023</p>

<p>13 Mar 2021, 71adc77.</p>

</dd>
<dt id="Simplify-sub-weld_nested_containers"><b>Simplify sub weld_nested_containers</b></dt>
<dd>

<p>This update consolidates a number of specialized rules for welding into fewer, simpler rules which accomplish the same effect.</p>

<p>These cases are fixed with this update: b186 b520 b872 b937 b996 b997 b1002 b1003 b1004 b1005 b1006 b1013 b1014</p>

<p>There are no current open issues with the weld logic.</p>

<p>10 Mar 2021, cf3ed23.</p>

</dd>
<dt id="Adjust-line-length-tolerance-for-welding"><b>Adjust line length tolerance for welding</b></dt>
<dd>

<p>A minor tolerance adjustment was needed to fix some edge welding cases.</p>

<p>This fixes cases b995 b998 b1000 b1001 b1007 b1008 b1009 b1010 b1011 b1012 b1016 b1017 b1018</p>

<p>7 Mar 2021, b9166ca.</p>

</dd>
<dt id="Fix-problem-with--vtc-n-and-outdented-long-lines"><b>Fix problem with -vtc=n and outdented long lines</b></dt>
<dd>

<p>Random testing produced an issue with -vtc=1 and an outdented long line. The parameters for b999 are</p>

<pre><code>    --maximum-line-length=75
    --paren-vertical-tightness-closing=1</code></pre>

<p>File &#39;b999.in&#39; state 1 is</p>

<pre><code>                while ( $line =~
    s/^([^\t]*)(\t+)/$1.(&quot; &quot; x ((length($2)&lt;&lt;3)-(length($1)&amp;7)))/e
                  )</code></pre>

<p>and state 2 is</p>

<pre><code>                while ( $line =~
    s/^([^\t]*)(\t+)/$1.(&quot; &quot; x ((length($2)&lt;&lt;3)-(length($1)&amp;7)))/e)</code></pre>

<p>The problem was fixed by turning off caching for outdented long lines. This fixes case b999.</p>

<p>7 Mar 2021, 3da7e41.</p>

</dd>
<dt id="Fix-problem-with-combination--lp-and--wbb"><b>Fix problem with combination -lp and -wbb=&#39;=&#39;</b></dt>
<dd>

<p>Random testing produced case b932 in which the combination -lp and -wbb=&#39;=&#39; was not stable.</p>

<p>File &#39;b932.par&#39; is:</p>

<pre><code>    --line-up-parentheses
    --maximum-line-length=51
    --want-break-before=&#39;=&#39;</code></pre>

<p>File &#39;b932.in&#39; in the desired state is:</p>

<pre><code>    my @parts
      = decompose( &#39;(\s+|/|\!|=)&#39;,
                   $line, undef, 1, undef, &#39;[&quot;\&#39;]&#39; );</code></pre>

<p>The alternate state is</p>

<pre><code>    my @parts = decompose( &#39;(\s+|/|\!|=)&#39;,
                     $line, undef, 1, undef, &#39;[&quot;\&#39;]&#39; );</code></pre>

<p>The problem was that the -lp code which set a line break at the equals did not check the -wba flag setting.</p>

<p>This update fixes case b932.</p>

<p>7 Mar 2021, 63129c3.</p>

</dd>
<dt id="Fix-edge-formatting-cases-with-parameter--bbx-2"><b>Fix edge formatting cases with parameter -bbx=2</b></dt>
<dd>

<p>Random testing produced some cases where formatting with parameters of the form --break-before-..=2 can lead to unstable final states. The problem lies in the definition of a broken list. The problem is fixed by defining a broken list for this particular flag to be a list with at least one non-terminal line-ending comma. This insures that the list will remain broken on subsequent iterations. This fixes cases b789 and b938.</p>

<p>6 Mar 2021, 360d669.</p>

</dd>
<dt id="Add-flag--fpva---function-paren-vertical-alignment"><b>Add flag -fpva, --function-paren-vertical-alignment</b></dt>
<dd>

<p>A flag -fpva, --function-paren-vertical-alignment, is added to prevent vertical alignment of function parens when the -sfp flag is used. This is on by default, so that existing formatting remains unchanged unless the user requests that vertical alignment not occur with -nfpva.</p>

<p>5 Mar 2021, 312be4c.</p>

</dd>
<dt id="Fix-for-issue-git-53-do-not-align-spaced-function-parens"><b>Fix for issue git #53, do not align spaced function parens</b></dt>
<dd>

<p>Introducing a space before a function call paren had a side effect of allowing the vertical aligner to align the parens, as in the example.</p>

<pre><code>    # OLD and NEW, default without -sfp:
    log_something_with_long_function( &#39;This is a log message.&#39;, 2 );
    Coro::AnyEvent::sleep( 3, 4 );

    # OLD: perltidy -sfp 
    log_something_with_long_function ( &#39;This is a log message.&#39;, 2 );
    Coro::AnyEvent::sleep            ( 3, 4 );

    # NEW: perltidy -sfp 
    log_something_with_long_function ( &#39;This is a log message.&#39;, 2 );
    Coro::AnyEvent::sleep ( 3, 4 );</code></pre>

<p>This update changes the default to not do this vertical alignment. This should have been the default but this side-effect was missed when the -sfp parameter was added. Note that parens following keywords are likewise not vertically aligned.</p>

<p>5 Mar 2021, 00431bf.</p>

</dd>
<dt id="Fix-issue-git-54-involving--bbp-n-and--bbpi-n"><b>Fix issue git#54 involving -bbp=n and -bbpi=n</b></dt>
<dd>

<p>In this issue, different results were obtained depending upon the existence of a comma in a list. To fix this, the definition of a list was adjusted from requiring one or more commas to requiring either a fat comma or a comma.</p>

<p>At the same time, a known problem involving the combination -lp -bbp=n -bbpi=n was fixed. This fixes cases b826 b909 b989.</p>

<p>4 Mar 2021, 872d4b4.</p>

</dd>
<dt id="Fix-several-minor-weld-issues"><b>Fix several minor weld issues</b></dt>
<dd>

<p>Some edge cases for the welding parameter -wn have been fixed. There are no other currently known weld issues. Some debug code for welding has been left in the code for possible future use.</p>

<p>This fixes cases b109 b110 b520 b756 b901 b937 b965 b982 b988 b991 b992 b993</p>

<p>3 Mar 2021, cfef087.</p>

</dd>
<dt id="Update-tokenizer-recognition-of-indirect-object"><b>Update tokenizer recognition of indirect object</b></dt>
<dd>

<p>This is the parameter file b990.pro: --noadd-whitespace --continuation-indentation=0 --maximum-line-length=7 --space-terminal-semicolon</p>

<p>Applying perltidy -pro=b990.pro to the following snippet gave two states</p>

<pre><code>    # State 1
    print
    H;

    # State 2
    print H
    ;</code></pre>

<p>The tokenizer was alternately parsing &#39;H&#39; as either possble indirect object, &#39;Z&#39;, or indirect object, &#39;Y&#39;. Two fixes were tested. The first was to modify the tokenizer to recognize a &#39;;&#39; as well as a space as a direct object terminator. An alternative fix is to not allowing a break before type &#39;Y&#39; so that the tokenizer kept parsing as type &#39;Y&#39;. Both fixes work, but the latter fix would change existing formatting by the -extrude option, so the first fix was used. With this fix, the stable state is &#39;State 1&#39; above.</p>

<p>This update is a generalization of the update <a href="#Fixed-blinker-related-to-line-break-at-indirect-object">&quot;Fixed blinker related to line break at indirect object&quot;</a> of 16 Jan 2021.</p>

<p>This fixes case b990. 1 Mar 2021, 49cd66f.</p>

</dd>
<dt id="Do-not-start-a-batch-with-a-blank-token"><b>Do not start a batch with a blank token</b></dt>
<dd>

<p>Perltidy does final formatting in discrete batches of tokens, where a batch is a continuous section of the total token list. A batch begins a new line and will be broken into one or more lines. If a batch starts with a blank token it will simply be skipped on on output. However, some rare problems have been found in random testing which can occur if a batch starts with a blank. An example is case b984 which has the following parameters:</p>

<pre><code>        # this is file &#39;b984.pro&#39;
        --block-brace-vertical-tightness=2
        --indent-columns=10
        --maximum-line-length=27
        --outdent-keywords
        --variable-maximum-line-length

          # OLD: perltidy -pro=b984.pro
          unless (
                    exists $self-&gt;{
                              &#39;accession_number&#39;} )
          {         return &quot;unknown&quot;;
          }

          # NEW: perltidy -pro=b984.pro
          unless (
                    exists $self-&gt;{
                              &#39;accession_number&#39;} )
          {       return &quot;unknown&quot;;
          }</code></pre>

<p>Both look OK, but the OLD version did not outdent the keyword &#39;return&#39; as requested with the -okw flag.</p>

<p>This update fixes cases b149 b888 b984 b985 b986 b987.</p>

<p>28 Feb 2021, 8aaf599.</p>

</dd>
<dt id="Avoid-double-spaces-in--csc-text-output"><b>Avoid double spaces in -csc text output</b></dt>
<dd>

<p>Random testing produced some rare cases where two spaces could occur in -csc text. This happened when there were multiple lines and the formatter placed a leading blank in one of the continuation lines as padding. This has been fixed.</p>

<p>For example</p>

<pre><code>    while (
        &lt;&gt;;
      )
    {
       ...
    } ## end while ( &lt;&gt;; )</code></pre>

<p>Previously, the last line had an extra space after the &#39;;&#39;</p>

<pre><code>    } ## end while ( &lt;&gt;;  )</code></pre>

<p>Another example</p>

<pre><code>    while (
        do {
            { package DB; @a = caller( $i++ ) }
        }
      )
    {
      ...
    } ## end while ( do { { package DB...}})</code></pre>

<p>Previously the last line had an extra space between the opening braces:</p>

<pre><code>    } ## end while ( do {  { package DB...}})</code></pre>

<p>27 Feb 2021, b22e891.</p>

</dd>
<dt id="Remove-control-of-debug-flag--fll"><b>Remove control of debug flag -fll</b></dt>
<dd>

<p>Random testing produced an unstable state when a debug flag, -nfll, was set. The only time it is appropriate to set this flag is if the -extrude option is set, so a check was added to verify this. This fixes case b935.</p>

<p>27 Feb 2021, 9155b3d.</p>

</dd>
<dt id="Restrict-previous-update-to-just--vmll"><b>Restrict previous update to just -vmll</b></dt>
<dd>

<p>The previous update was found to occasionally needlessly change existing formatting with very long long lines. So it is restricted to just when -vmll is set. For example, it is ok to keep the long quote following the opening paren in the following case.</p>

<pre><code>  # perltidy -gnu
  ok( &quot;got to the end without dying (note without DEBUGGING passing this test means nothing)&quot;
    );</code></pre>

<p>26 Feb 2021, 2b88464.</p>

</dd>
<dt id="Add-a-gap-calculation-in-line-length-tests-with--vmll"><b>Add a gap calculation in line length tests with -vmll</b></dt>
<dd>

<p>This fixes case b965. The -vmll flag can produce gaps in lines which need to be included in weld line length estimates.</p>

<p>26 Feb 2021, a643cf2.</p>

</dd>
<dt id="Update-rule-for-spacing-paren-after-constant-function"><b>Update rule for spacing paren after constant function</b></dt>
<dd>

<p>Random testing produced an unstable state for the following snippet (case b934)</p>

<pre><code>        sub pi();
        if (
            $t &gt;
            pi( )
              )</code></pre>

<p>when run with these parameters:</p>

<pre><code>  --continuation-indentation=6
  --maximum-line-length=17
  --paren-vertical-tightness-closing=2</code></pre>

<p>The formatting was stable without the first line, which declares &#39;pi&#39; to be a constant sub. The problem was fixed by updating a regex to treat the spacing of a paren following a sub the same for the two token types, &#39;U&#39; or &#39;C&#39; (constant function).</p>

<p>This fixes case b934, 12bfdfe.</p>

<p>26 Feb 2021.</p>

</dd>
<dt id="Improve-line-length-test-for-the--vtc-2-option"><b>Improve line length test for the -vtc=2 option</b></dt>
<dd>

<p>This is a small change to the update of 13 Feb 2021, f79a4f1. Random testing produced additional blinking states caused by the combination of -vtc=2 and -vmll flag, plus several others. The problem was that a line length check in the vertical aligner was being skipped as an optimization if it didn&#39;t appear necessary. The unusual properties of the -vmll flag require that the check always be done.</p>

<p>This fixes cases b656 b862 b971 b972.</p>

<p>26 Feb 2021, 80107e0.</p>

</dd>
<dt id="Improve-one-line-block-length-tests"><b>Improve one-line block length tests</b></dt>
<dd>

<p>Some oscillating states produced in random parameter tests were traced to problems with forming one-line blocks. A more precise length test was added to fix this.</p>

<p>This fixes cases b562 b563 b574 b777 b778 b924 b936 b975 b976 b983.</p>

<p>In the process of fixing this issue, a glitch was discovered in the previous coding of the -bl (braces-left) flag that caused somewhat random results for block types sort/map/grep/eval. The problem was a conflict between the logic for forming one-line blocks and the logic for applying the -bl flag. Usually, -bl formatting was not applied to these block types, but occasionally it was. To minimize changes in existing formatting, in the new version the -bl flag is not applied to these block types. A future flag could be added to give user control over which of these block types are under -bl control.</p>

<p>25 Feb 2021, 92bec8d.</p>

</dd>
<dt id="Add-tolerance-to-one-line-block-length-tests"><b>Add tolerance to one-line block length tests</b></dt>
<dd>

<p>Testing with random input parameters produced some cases in which a stable solution could not be found due to attempts to form one-line blocks near the end of a long line. The problem was fixed by adding a small tolerance to the line length test. This does not change existing formatting.</p>

<p>This fixes cases b069 b070 b077 b078.</p>

<p>21 Feb 2021, 0b97b94.</p>

</dd>
<dt id="Restrict--bom-at-cuddled-method-calls"><b>Restrict -bom at cuddled method calls</b></dt>
<dd>

<p>The -bom flag tries to keep old breakpoints at lines beginning with &#39;-&gt;&#39; and also with some lines beginning with &#39;)-&gt;&#39;. These latter lines can lead to blinking states in cases where the opening paren is on the previous line. To fix this, a restriction was added that the line difference between the opening and closing parens should be more than 1.</p>

<p>This fixes case b977.</p>

<p>21 Feb 2021, 28114e9.</p>

</dd>
<dt id="Add-weld-rule-to-avoid-conflict-between--wn-and--bom"><b>Add weld rule to avoid conflict between -wn and -bom</b></dt>
<dd>

<p>Testing with ramdom input parameters produced states which were oscillating because of a conflict between the -wn and -bom parameters. The problem was resolved by giving the -bom parameter priority over -wn.</p>

<p>These cases are fixed with this update: b966 b973</p>

<p>20 Feb 2021.</p>

</dd>
<dt id="Limit-the-value-of--ci-n-to-that-of--i-n-when--xci-is-set"><b>Limit the value of -ci=n to that of -i=n when -xci is set</b></dt>
<dd>

<p>Testing with random input parameters produced a number of oscillating states which had both parameter -xci as well as a value of -ci=n which exceeded the value of -i=n. To correct this, perltidy will silently reduce the -ci value to the -i value when -xci is also set. This should not change existing formatting because a value of -ci greater than -i would not normally be used in practice.</p>

<p>These cases are fixed with this update: b707 b770 b912 b920 b930 b933 b939 b940 b941 b942 b978 b974 b979 b980 b981</p>

<p>20 Feb 2021, c16c5ee.</p>

</dd>
<dt id="Modify-length-tolerance-for-welding-to-qw-lists"><b>Modify length tolerance for welding to qw lists</b></dt>
<dd>

<p>Several cases of alternating states were produced in random testing which were caused by line length limits being reached when welding to qw lists. This was fixed by adding a small tolerance to line length tests.</p>

<p>This fixes cases b654 b655 b943 b944 b967 b968 b969 b970.</p>

<p>19 Feb 2021, 0baafc8.</p>

</dd>
<dt id="Modify-space-rule-between-binary-plus-or-minus-and-a-bareword"><b>Modify space rule between binary plus or minus and a bareword</b></dt>
<dd>

<p>The update of 13 Feb 2021, cf414fe, has been modified to be less restrictive. Space between a binary plus and minus and a bareword may now be removed in some cases where no tokenization ambiguity exists. 18 Feb 2021, a8564c8.</p>

</dd>
<dt id="Do-not-apply--xci-if-it-would-put-tokens-beyond-the-maximum-line-length"><b>Do not apply -xci if it would put tokens beyond the maximum line length</b></dt>
<dd>

<p>This update fixes cases b899 b935. 17 Feb 2021, b955a7c.</p>

</dd>
<dt id="Do-not-weld-to-a-hash-brace"><b>Do not weld to a hash brace</b></dt>
<dd>

<p>The reason is that it has a very strong bond strength to the next token, so a line break after it may not work. Previously we allowed welding to something like &#39;@{&#39; but even that caused blinking states (cases b751, b779).</p>

<p>This will not change much existing code. This update fixes cases b751 b779.</p>

<p>16 Feb 2021, eb2f4e7.</p>

</dd>
<dt id="Avoid-line-breaks-after-token-type-G"><b>Avoid line breaks after token type &#39;G&#39;</b></dt>
<dd>

<p>Random testing with very short maximum line lengths produced some blinking states which were traced to the tokenizer alternately parsed an unknown bareword as type &#39;w&#39; or type &#39;G&#39;, depending on whether or not an opening block brace immediately followed on the same line. To fix this, a rule was added which prevents a line break between a type &#39;G&#39; token and an opening code block brace.</p>

<p>This update fixes these cases: b900 b902 b928 b929</p>

<p>15 Feb 2021, f005a95.</p>

</dd>
<dt id="Restrict-breaking-at-old-uncontained-commas"><b>Restrict breaking at old uncontained commas</b></dt>
<dd>

<p>Random testing with very short maximum line lengths produced some blinking states which were traced to duplicating old comma breakpoints which were not really good breakpoints. A patch was made to be more selective.</p>

<p>These cases are fixed with this update: b610 b757 b931</p>

<p>15 Feb 2021, 98b41a0.</p>

</dd>
<dt id="Modify-line-length-test-for-the--vtc-2-option"><b>Modify line length test for the -vtc=2 option</b></dt>
<dd>

<p>The line length test which was added Feb 13 2021 turns out to be more restrictive than necessary. A modification was made to only apply it if a new one-line block would be formed. This prevents it from needlessly changing existing formatting.</p>

<p>The following cases were re-activated after this update: b654 b655 b656 b862</p>

<p>15 Feb 2021, 4673fdd.</p>

</dd>
<dt id="Use-increased-line-length-tolerance-if-ci-exceeds-i"><b>Use increased line length tolerance if ci exceeds i</b></dt>
<dd>

<p>In testing perltidy with random input parameters, some blinking states occurred when the value of -ci was significantly larger than the value of -i. (In actual practice, -ci is not normally set greater than -i). This update adds a tolerance to line length tests which avoids this problem. This fixes the following cases</p>

<p>b775 b776 b826 b908 b910 b911 b923 b925 b926 b927</p>

<p>14 Feb 2021, 8451f2f.</p>

</dd>
<dt id="Keep-space-between-binary-plus-or-minus-and-a-bareword"><b>Keep space between binary plus or minus and a bareword</b></dt>
<dd>

<p>This update makes a space between a binary + or - and a bareword an essential whitespace. Otherwise, they may be converted into unary + or - on the next pass, which can lead to blinking states. Fixes cases b660 b670 b780 b781 b787 b788 b790.</p>

<p>13 Feb 2021, cf414fe.</p>

</dd>
<dt id="Prevent-breaks-after-unary-plus-and-minus"><b>Prevent breaks after unary plus and minus</b></dt>
<dd>

<p>Some alternating states were produced when extremely maximum line lengths forced a break after a unary plus or minus. Fixes cases b670 b790.</p>

<p>13 Feb 2021, cf414fe.</p>

</dd>
<dt id="Add-line-length-test-for-the--vtc-2-option"><b>Add line length test for the -vtc=2 option</b></dt>
<dd>

<p>Random testing produced a number of cases of blinking states which were caused when the -vtc=2 flag caused the vertical aligner to combine lines which exceeded the allowable line length. These long lines were then getting reduced in size on every other iteration. A line length test was added in the vertical aligner to prevent this. This fixes these cases:</p>

<p>b654 b655 b656 b657 b761 b762 b763 b764 b765 b766 b767 b768 b769 b862 b904 b905 b906 b907 b913 b914 b915 b916 b917 b918 b919</p>

<p>13 Feb 2021, f79a4f1.</p>

</dd>
<dt id="Define-left-side-bond-strengths-for-unary-plus-and-minus"><b>Define left side bond strengths for unary plus and minus</b></dt>
<dd>

<p>Random testing produced a blinking state which was traced to the unary plus not having a defined strength in the line break algorithm. This was fixed by setting it to be the same as the left strength of a plus. This fixes case b511. 12 Feb 2021, 58a7895.</p>

</dd>
<dt id="Fix-problem-with-breaking-at-an-sign"><b>Fix problem with breaking at an = sign</b></dt>
<dd>

<p>Random testing produced some blinking cases which were related to detecting an old good breakpoint at an equals. If the user requested that a break be done before an equals, and the input script had a break after an equals, then that break should not have been marked as a good existing break point before a keyword. This update fixes cases b434 b903.</p>

<p>11 Feb 2021, f9a8543.</p>

</dd>
<dt id="Fix-conflict-of--kbl-0-and-essential-space-after-cut"><b>Fix conflict of -kbl=0 and essential space after =cut</b></dt>
<dd>

<p>Random testing produced a case where a blank line after an =cut was alternately being deleted and added due to a conflict with the flag setting -keep-old-blank-lines=0. This was resolved by giving prioritiy to the essential blank line after the =cut line.</p>

<p>This fixes case b860. 11 Feb 2021, 8c13609.</p>

</dd>
<dt id="Do-not-break-one-line-block-at-here-target"><b>Do not break one-line block at here target</b></dt>
<dd>

<p>A blinking state produced by random testing was traced to a line of coding which which unnecessarily prevented one-line blocks from being formed when a here-target was encountered. This has been fixed.</p>

<p>For example, the code block in the following contains a here target and was being broken into two lines:</p>

<pre><code>    unless ($INC{$file}) {
        die &lt;&lt;&quot;END_DIE&quot; }</code></pre>

<p>These will now be output with the blocks intact, like this</p>

<pre><code>    unless ($INC{$file}) { die &lt;&lt;&quot;END_DIE&quot; }</code></pre>

<p>This fixes case b523. 11 Feb 2021, 6d5bb74.</p>

</dd>
<dt id="Skip-processing--kgb-flags-in-lists-or-if--maximum-consecutive-blank-lines-0"><b>Skip processing -kgb* flags in lists or if -maximum-consecutive-blank-lines=0</b></dt>
<dd>

<p>Random testing produced an alternating state which was caused by -kgb flags being active on keywords which were in a list rather than a code block. A check was added to prevent this. Also, the -kgb* flags have no effect if no blank lines can be output, so a check was added for this situation. This fixes case b760.</p>

<p>10 Feb 2021, 177fc3a.</p>

</dd>
<dt id="Modify-tolerance-in-testing-for-welds"><b>Modify tolerance in testing for welds</b></dt>
<dd>

<p>Random testing with unusual parameters produced some blinking weld states which were fixed by modifying a tolerance used in a line length test. The following cases were fixed with this update:</p>

<p>b746 b748 b749 b750 b752 b753 b754 b755 b756 b758 b759 b771 b772 b773 b774 b782 b783 b784 b785 b786</p>

<p>9 Feb 2021, a4609ac.</p>

</dd>
<dt id="Modified-rule-for-breaking-lines-at-old-commas"><b>Modified rule for breaking lines at old commas</b></dt>
<dd>

<p>Random testing produced some blinking cases resulting from the treatment of old line breaks at commas not contained within containers. The following cases were fixed with this update:</p>

<p>b064 b065 b068 b210 b747</p>

<p>This change has no effect on scripts with normal parameter values. 9 Feb 2021, 5c23661.</p>

</dd>
<dt id="Restrict-references-to-old-line-breaks"><b>Restrict references to old line breaks</b></dt>
<dd>

<p>A number of cases of blinking states were traced to code which biased the breaking of long lines to existing breaks. This was fixed by restricting this coding to just use old comma line break points.</p>

<p>The following cases were fixed with this update:</p>

<p>b193 b194 b195 b197 b198 b199 b216 b217 b218 b219 b220 b221 b244 b245 b246 b247 b249 b251 b252 b253 b254 b256 b257 b258 b259 b260 b261 b262 b263 b264 b265 b266 b268 b269 b270 b271 b272 b274 b275 b278 b280 b281 b283 b285 b288 b291 b295 b296 b297 b299 b302 b304 b305 b307 b310 b311 b312 b313 b314 b315 b316 b317 b318 b319 b320 b321 b322 b323 b324 b325 b326 b327 b329 b330 b331 b332 b333 b334 b335 b336 b337 b338 b339 b340 b341 b342 b343 b344 b345 b346 b347 b348 b349</p>

<p>8 Feb 2021, 66be455.</p>

</dd>
<dt id="Fix-rare-problem-involving-interaction-of--olbn-n-and--wn-flags"><b>Fix rare problem involving interaction of -olbn=n and -wn flags</b></dt>
<dd>

<p>Random testing revealed a rare alternating state which could occur when both flags --one-line-block-nesting=n and --weld-nested-containers are set, and the maximum line length is set very low. The problem was fixed by ignoring the first flag at welded tokens. This should not have any effect on scripts with realistic parameter values.</p>

<p>The following case was fixed with this update: b690.</p>

<p>6 Feb 2021, 3e96930.</p>

</dd>
<dt id="add-rule-to-avoid-welding-at-some-barewords"><b>add rule to avoid welding at some barewords</b></dt>
<dd>

<p>A rule was added to prevent certain rare blinking states involving welding. The rule is that if an opening container is immediately followed by a bareword which is unknown, a weld will be avoided.</p>

<p>The following cases were fixed with this update: b611 b626.</p>

<p>6 Feb 2021, 6b1f44a</p>

</dd>
<dt id="further-simplify--bbxi-n-implementation"><b>further simplify -bbxi=n implementation</b></dt>
<dd>

<p>This update adds a new variable which indicates if a container is permanently broken due to a side comment or blank line. This helps reduce the number of cases where the -bbxi=n flag cannot be applied. Another change was to always apply the -bbx=n flag, even if the -bbxi=n flag cannot be applied. These two flags now operate almost exactly as in previous versions but without the blinking problem. The only difference is that now the -bbxi=n flag with n&gt;0 will revert to n=0 for some short containers which might not be broken open.</p>

</dd>
<dt id="reset--bbxi-2-to--bbxi-0-if--lp-is-set-to-avoid-blinking-states"><b>reset -bbxi=2 to -bbxi=0 if -lp is set to avoid blinking states</b></dt>
<dd>

<p>The options of the form bbxi=2, such as break-before-paren-and-indent=2, have been found to cause blinking states if the -lp flag is set. Both of these options are fairly rare. To correct this the -bbxi=2 flag is now reset to -bbxi=0 if the -lp flag is set. Note that -bbxi=2 and -bbxi=0 give the same formatting result with the common setting -ci=4 and -i=4.</p>

<p>The following cases were fixed with this update:</p>

<p>b396 b397 b398 b429 b435 b457 b502 b503 b504 b505 b538 b540 b542 b617 b618 b619 b620 b621</p>

<p>3 Feb 2021, 67ab0ef.</p>

</dd>
<dt id="rewrite-sub-break_before_list_opening_containers"><b>rewrite sub break_before_list_opening_containers</b></dt>
<dd>

<p>sub break_before_list_opening_containers was rewritten to reduce the chance of producing alternating states.</p>

<p>The following cases were fixed with this update:</p>

<p>b030 b032 b455 b456 b458 b459 b460 b461 b462 b536 b622 b651 b652 b653 b708 b709 b710 b713 b714 b719 b723 b724 b725 b726 b727 b729 b731 b733 b735 b736 b737 b738 b739 b740 b743 b744</p>

<p>3 Feb 2021, 5083ab9.</p>

</dd>
<dt id="redefine-list-to-have-at-least-one-internal-comma"><b>redefine list to have at least one internal comma</b></dt>
<dd>

<p>Random testing produced some blinking states which could be fixed by changing the definition of a list, for formatting purposes, to have one or more interior commas rather than simply one or more commas. The difference is that something with a single terminal comma, like &#39;( $x, )&#39;, is no longer classified as a list. This makes no difference except when perltidy is stress tested with unusual parameters.</p>

<p>The following cases were fixed with this update:</p>

<p>b116 b119 b122 b174 b179 b187 b361 b369 b370 b372 b376 b427 b428 b448 b449 b450 b451 b452 b453 b469 b473 b474 b475 b476 b477 b479 b480 b481 b482 b497 b552 b553 b554 b558 b559 b634 b637 b642 b644 b645 b647 b650 b661 b662 b663 b664 b666 b677 b685 b688 b698 b699 b700 b702 b703 b704 b711 b712 b715 b716 b717 b718 b721 b730 b734 b741 b742</p>

<p>1 Feb 2021, 35078f7.</p>

</dd>
<dt id="rewrite-and-combine-coding-for--bbx-n-and--bbxi-n"><b>rewrite and combine coding for -bbx=n and -bbxi=n</b></dt>
<dd>

<p>Random testing produced a large number of blinking states involving parameters such as --break-before-parens=n and --break-before-parens-and-indent=n and similar pairs. The problem was traced to the fact that the former parameter was implemented late in the pipeline whereas the latter parameter was implemented early in the pipeline. Normally there was no problem, but in some extreme cases, often involving very short maximum line lengths, this could produce alternating output states. The problem was resolved by combining the implementation of both flags in a single new sub to avoid any inconsistencies. The following cases were fixed with this update:</p>

<p>b018 b066 b071 b079 b090 b105 b146 b149 b158 b160 b161 b163 b164 b166 b167 b169 b170 b171 b172 b178 b185 b190 b192 b203 b206 b222 b223 b224 b237 b359 b362 b377 b379 b381 b382 b389 b395 b407 b408 b409 b410 b411 b412 b414 b417 b418 b419 b421 b433 b438 b443 b444 b478 b483 b484 b486 b490 b492 b493 b494 b496 b506 b507 b517 b521 b522 b524 b525 b535 b537 b539 b541 b543 b546 b550 b551 b555 b564 b566 b567 b569 b570 b572 b573 b575 b576 b577 b578 b579 b580 b582 b586 b587 b588 b589 b590 b591 b592 b593 b603 b607 b609 b613 b615 b616 b623 b624 b630 b635 b636 b638 b639 b640 b641 b643 b646 b648 b649 b658 b659 b665 b667 b668 b669 b671 b672 b673 b674 b675 b676 b678 b679 b680 b681 b682 b683 b684 b686 b687 b689 b691 b692 b693 b694 b695 b696 b697 b701 b705 b706 b720 b722 b728 b732 b745</p>

<p>31 Jan 2021, 10e8bfd.</p>

</dd>
<dt id="adjust-line-length-and-token-count-tolerances-for--wn"><b>adjust line length and token count tolerances for -wn</b></dt>
<dd>

<p>Most remaining edge cases of blinking states involving the -wn parameter have been fixed by adjusting some tolerances in sub weld_nested_containers. The following cases are fixed with this update:</p>

<p>b156 b157 b186 b196 b454 b520 b527 b530 b532 b533 b534 b612 b614 b625 b627</p>

<p>This update has no effect for realistic parameter settings.</p>

<p>30 Jan 2021, d359a60.</p>

</dd>
<dt id="fix-additional-edge-blinker-cases-involving--wn"><b>fix additional edge blinker cases involving -wn</b></dt>
<dd>

<p>Some blinking cases produced in random testing were traced to welding in very short lines (length = 20 for example) in which a weld was made to a square bracket containing just a single parameter, so that it had no good internal breaking points. A rule was added to avoid welding to a square bracket not containing any commas. The following cases were fixed with the update:</p>

<p>b002 b003 b005 b006 b007 b009 b010 b014 b015 b017 b020 b111 b112 b113 b124 b126 b128 b151 b153 b439 b606</p>

<p>29 Jan 2021, 33f1f2b.</p>

</dd>
<dt id="fix-additional-edge-blinker-cases-involving--wn1"><b>fix additional edge blinker cases involving -wn</b></dt>
<dd>

<p>Random testing produced some blinking states which were traced to the precision of a line length test. In sub weld_nested_containers, the test</p>

<pre><code>    $do_not_weld ||= $excess_length_to_K-&gt;($Kinner_opening) &gt; 0;</code></pre>

<p>was changed to allow a 1 character margin of error:</p>

<pre><code>    $do_not_weld ||= $excess_length_to_K-&gt;($Kinner_opening) &gt;= 0;</code></pre>

<p>The following cases were fixed with this update:</p>

<p>b025 b075 b091 b109 b110 b152 b154 b155 b162 b168 b176 b422 b423 b424 b425 b426 b565</p>

<p>29 Jan 2021, 33f1f2b.</p>

</dd>
<dt id="fix-some-edge-blinker-cases-involving--wn"><b>fix some edge blinker cases involving -wn</b></dt>
<dd>

<p>Random testing produced some blinking states which were eliminated by a simplification of the definition of a one_line_weld in sub weld_nested_containers. The following cases were fixed with this update:</p>

<p>b131 b134 b136 b205 b233 b238 b284 b350 b352 b358 b385 b487 b604 b605</p>

<p>29 Jan 2021, 33f1f2b.</p>

</dd>
<dt id="fix-some-edge-blinker-cases-involving--bbxi-n-esp.-with--boc"><b>fix some edge blinker cases involving -bbxi=n esp. with -boc</b></dt>
<dd>

<p>The following cases were fixed with this update:</p>

<p>b041 b182 b184 b366 b367 b368 b370 b371 b382 b420 b432 b438 b464 b466 b467 b468 b500 b501 b508 b509 b510 b512 b513 b514 b515 b516 b526 b528 b529 b531 b544 b545 b547 b548 b549 b556 b557 b568 b571 b581 b583 b584 b585 b594 b595 b596 b597 b598 b599 b600 b601 b602 b608 b041 b182 b184 b355 b356 b366 b367 b368 b371 b420 b432 b464 b465 b466 b467 b468 b500 b501 b508 b509 b510 b512 b513 b514 b515 b516 b526 b528 b529 b531 b544 b545 b547 b548 b549 b556 b557 b568 b571 b581 b583 b584</p>

<p>28 Jan 2021.</p>

</dd>
<dt id="fix-problem-with-combination--cab-2-and-bbhbi-n"><b>fix problem with combination -cab=2 and bbhbi=n</b></dt>
<dd>

<p>Random testing produced a number of cases in which the combination -cab=2 and bbhbi=n and similar flags were in conflict, causing alternating states. This was fixed by not changing ci for containers which can fit entirely on one line, which is what -cab=2 says to do. The following cases were fixed with this update:</p>

<p>b046 b061 b081 b084 b089 b093 b130 b133 b135 b138 b142 b145 b147 b150 b165 b173 b191 b211 b294 b309 b360 b363 b364 b365 b373 b386 b387 b388 b392 b437 b440 b472 b488 b489</p>

<p>27 Jan 2021, 6d710de.</p>

</dd>
<dt id="fix-problem-with--freeze-whitespace"><b>fix problem with -freeze-whitespace</b></dt>
<dd>

<p>Random testing produced a case in which the --freeze-whitespace flag (which is mainly useful for testing) could cause a blank space which kept increasing. The problem was caused by the &quot;vertical tightness&quot; mechanism. Turning it off when the -freeze-whitespace-flag is on fixed the problem. The following cases were fixed with this update:</p>

<p>b037 b038 b043 b059 b060 b067 b072 b215 b225 b267 b273 b276 b279 b282 b289 b292 b300 b303 b354 b374 b375 b383 b384 b402 b403 b404 b405 b436 b441 b445 b446 b471 b485 b498 b499</p>

<p>27 Jan 2021, 6d710de.</p>

</dd>
<dt id="Avoid-blinking-states-associated-with--bbpi-and-similar-flags"><b>Avoid blinking states associated with -bbpi and similar flags</b></dt>
<dd>

<p>Random testing with extreme parameter values revealed blinking states associated with the -bbpi and related flags. The problem was that continuation indentation was sometimes being added according to the flag but the lists were not actually being broken. After this was fixed the following cases ran correctly:</p>

<p>b024 b035 b036 b040 b042 b047 b049 b050 b051 b052 b053 b054 b057 b062 b063 b073 b074 b076 b080 b083 b085 b086 b087 b088 b102 b103 b104 b106 b107 b108 b115 b118 b121 b123 b125 b127 b132 b137 b139 b140 b141 b143 b144 b148 b159 b175 b177 b180 b181 b188 b189 b200 b201 b202 b204 b207 b212 b213 b214 b226 b227 b228 b229 b230 b232 b239 b240 b241 b243 b248 b250 b255 b277 b286 b287 b290 b293 b298 b301 b306 b308 b328 b351 b353 b357 b378 b380 b390 b391 b393 b394 b399 b400 b401 b406 b413 b415 b416 b430 b431 b442 b447 b463 b470 b491 b495</p>

<p>27 Jan 2021, 96144a3.</p>

</dd>
<dt id="Revise-coding-for-the---freeze-whitespace-option"><b>Revise coding for the --freeze-whitespace option</b></dt>
<dd>

<p>Random testing produced some blinking states which were traced to an incorrect implementation of the <b>--freeze-whitespace</b> option (which is mainly useful in stress testing perltidy). A related flag, --add-whitespace is involved. This update corrects these problems. Test cases include b057, b183, b242. 24 Jan 2021, 9956a57.</p>

</dd>
<dt id="Fix-for-issue-git-51-closing-qw-paren-not-outdented-when--ndnl-is-set"><b>Fix for issue git #51, closing qw paren not outdented when -ndnl is set</b></dt>
<dd>

<p>The problem is that a bare closing qw paren was not being outdented if the flag &#39;-nodelete-old-newlines is set. For example</p>

<pre><code>    # OLD (OK, outdented): perltidy -ci=4 -xci
    {
        modules =&gt; [
            qw(
                JSON
            )
        ],
    }


    # OLD (indented) : perltidy -ndnl -ci=4 -xci
    {
        modules =&gt; [
            qw(
                JSON
                )
        ],
    }

    # FIXED: perltidy -ndnl -ci=4 -xci
    {
        modules =&gt; [
            qw(
                JSON
            )
        ],
    }</code></pre>

<p>The problem happened because the -ndnl flag forces each line to be written immediately, so the next line (which needs to be checked in this case) was not available when the outdent decision had to be made. A patch to work around this was added 24 Jan 2021, 52996fb.</p>

</dd>
<dt id="Some-issues-with-the--lp-option"><b>Some issues with the -lp option</b></dt>
<dd>

<p>Random testing revealed some problems involving the <b>-lp</b> option which are fixed with this update.</p>

<p>The problem is illustrated with the following snippet</p>

<pre><code>    # perltidy -lp
    Alien::FillOutTemplate(
                &quot;$main::libdir/to-$main::desttype/$main::filetype/spec&quot;,
                &quot;$workdir/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec&quot;,
                %fields
    );</code></pre>

<p>which alternately formats to this form</p>

<pre><code>    # perltidy -lp
    Alien::FillOutTemplate(
                &quot;$main::libdir/to-$main::desttype/$main::filetype/spec&quot;,
                &quot;$workdir/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec&quot;,
                %fields );</code></pre>

<p>when formatted with the single parameter <b>-lp</b>. A number of similar examples were found in testing. The problem was traced to the treatment of the space which perltidy tentatively adds wherever there is a newline, just in case the formatted output has different line breaks. The problem was that the indentation level of these spaces was being set as the level of the next token rather than the previous token. Normally the indentation level of a space has no effect, but the <b>-lp</b> option does use it and this caused the problem. This was fixed 23 Jan 2021, edc7878.</p>

</dd>
<dt id="added-rule-for--wn-do-not-weld-to-a-hash-brace"><b>added rule for -wn, do not weld to a hash brace</b></dt>
<dd>

<p>In random testing, the following two alternating states</p>

<pre><code>    # State 1
    {
        if ( defined
        ($symbol_table{$direccion}) )
    }
    
    # State 2
    {
        if (defined (
                $symbol_table{
                    $direccion}
            )
        )
    }</code></pre>

<p>were occurring with the following particular parameter set</p>

<pre><code>    --weld-nested-containers
    --maximum-line-length=40
    --continuation-indentation=7
    --paren-tightness=2
    --extended-continuation-indentation</code></pre>

<p>The problem was traced to welding to the opening hash brace. A rule was added to prevent this, and testing with a large body of code showed that it did not significantly change existing formatting. With this change, the above snippet formats in the stable state</p>

<pre><code>    {
        if (defined(
            $symbol_table{$direccion}
        ))
    }</code></pre>

<p>20 Jan 2021, 4021436.</p>

</dd>
<dt id="Do-not-let--kgb-option-delete-essential-blank-after-cut"><b>Do not let -kgb option delete essential blank after =cut</b></dt>
<dd>

<p>A blinking state was found in random testing for the following snippet</p>

<pre><code>    =head1 TODO
    
    handle UNIMARC encodings
    
    =cut
    
    use strict;
    use warnings;</code></pre>

<p>when run with the following parameters</p>

<pre><code>    --keyword-group-blanks-size=&#39;2.8&#39;
    --keyword-group-blanks-before=0</code></pre>

<p>The space after the =cut was alternately being added as an essential blank which is required by pod utilities, and then deleted by these parameters. This was fixed 17 Jan 2021, b9a5f5d.</p>

</dd>
<dt id="Turn-off--boc-flag-if--iob-is-set"><b>Turn off -boc flag if -iob is set</b></dt>
<dd>

<p>In random testing, the cause of a blinker was traced to both flags --ignore-old-breakpoints and --break-at-old-comma-breakpoints being set. There is a warning message but the -boc flag was not actually being turned off. This was fixed 17 Jan 2021, b9a5f5d.</p>

</dd>
<dt id="Modified-spacing-rule-for-token-type-Y"><b>Modified spacing rule for token type Y</b></dt>
<dd>

<p>A space following a token type &#39;Y&#39; (filehandle) should not be removed. Otherwise it might be converted into type &#39;Z&#39; (possible filehandle). If that were to happen, the space could not be added back automatically in later formatting, so the user would have to do it by hand. This fix prevents this from happening. 17 Jan 2021, bef9a83.</p>

</dd>
<dt id="Fixed-blinker-related-to-line-break-at-indirect-object"><b>Fixed blinker related to line break at indirect object</b></dt>
<dd>

<p>In random testing a blinker was reduced to the following snippet</p>

<pre><code>    {
             print FILE
              GD::Barcode
              -&gt;new();
    }</code></pre>

<p>which switched to the following state on each iteration</p>

<pre><code>    {
             print FILE GD::Barcode
              -&gt;new();
    }</code></pre>

<p>with the following parameters</p>

<pre><code>    --maximum-line-length=20
    --indent-columns=9
    --continuation-indentation=1</code></pre>

<p>The problem was that the token &#39;FILE&#39; was either parsed as type &#39;Y&#39; or &#39;Z&#39; depending on the existence of a subsequent space. These have different line break rules, causing a blinker. The problem was fixed by modifying the tokenizer to consider a newline to be a space. Updated 16 Jan 2021, d40cca9.</p>

</dd>
<dt id="Turn-off--bli-if--bar-is-set"><b>Turn off -bli if -bar is set</b></dt>
<dd>

<p>A conflict arises if both <b>-bli</b> and <b>-bar</b> are set. In this case a warning message is given and <b>-bli</b> is turned off. Updated 15 Jan 2021, ef69531.</p>

</dd>
<dt id="Fixed-blinker-related-to-large--ci-short-line-length-and--bbsbi-2--bbsb-1"><b>Fixed blinker related to large -ci, short line length and -bbsbi=2 -bbsb=1</b></dt>
<dd>

<p>A blinking state was discovered in testing between the following two states</p>

<pre><code>    my$table=
         [[1,2,3],[2,4,6],[3,6,9],
         ];

    my$table=
        [[1,2,3],[2,4,6],[3,6,9],];</code></pre>

<p>with these parameters</p>

<pre><code>    --continuation-indentation=5
    --maximum-line-length=31
    --break-before-square-bracket-and-indent=2
    --break-before-square-bracket=1
    --noadd-whitespace</code></pre>

<p>The problem was found to be caused by the -bbsb parameters causing the indentation level of the first square bracket to change depending upon whether the term was broken on input or not. Two fixes would correct this. One is to turn off the option if the -ci=n value exceeds the -i=n value. The other is to require a broken container to span at least three lines before turning this option on. The latter option was made to sub &#39;adjust_container_indentation&#39;. With this change the snippet remains stable at the second state above. Fixed 14 Jan 2021, 5c793a1.</p>

</dd>
<dt id="Fixed-blinker-related-to-large--ci-short-line-length-and--wn"><b>Fixed blinker related to large -ci, short line length and -wn</b></dt>
<dd>

<p>In random testing with convergence a &#39;blinker&#39; (oscillating states) was found for the following script</p>

<pre><code>    sub _prompt {

          print $_[0];
          return (
                readline
                       (*{$_[1]})!~
                       /^q/i)
                 ; # Return false if user types &#39;q&#39;

    }</code></pre>

<p>with the following specific parameters:</p>

<pre><code>    --maximum-line-length=32
    --indent-columns=6
    --continuation-indentation=7
    --weld-nested-containers
    --extended-continuation-indentation
    --noadd-whitespace</code></pre>

<p>The other state was</p>

<pre><code>    sub _prompt {

          print $_[0];
          return (
                readline(
                      *{
                            $_
                                   [
                                   1
                                   ]
                      }
                )!~/^q/i
                 )
                 ; # Return false if user types &#39;q&#39;

    }</code></pre>

<p>All of the listed parameters are required to cause this, but the main cause is the very large continuation indentation and short line length. Welding was being turned on and off in this case. Normally welding is not done if all containers are on a single line, but an exception was made to detect a situation like this and keep the welded string together. Updated 13 Jan 2021, 5c793a1.</p>

</dd>
<dt id="Fixed-incorrect-guess-of-division-vs-pattern"><b>Fixed incorrect guess of division vs pattern</b></dt>
<dd>

<p>A syntax error was produced in random testing when perltidy was fed the following line:</p>

<pre><code>    sub _DR () { pi2 /360 } sub _RD () { 360 /pi2 }</code></pre>

<p>The bareword &#39;pi2&#39; was not recognized and the text between the two slashes was a taken as a possible pattern argument in a parenless call to pi2. Two fixes were made to fix this. Perltidy looks for &#39;pi&#39; but not &#39;pi2&#39;, so the first fix was to expand its table to include all variations of &#39;pi&#39; in Trig.pm. Second, the fact that the first slash was followed by a number should have tipped the guess to favor division, so this was fixed. As it was, a backup spacing rule was used, which favored a pattern.</p>

<p>The formatted result is now</p>

<pre><code>    sub _DR () { pi2 / 360 }
    sub _RD () { 360 / pi2 }</code></pre>

<p>This update was made 13 Jan 2021, a50ecf8.</p>

</dd>
<dt id="Correct-formula-for-estimating-line-length-with--wn-option"><b>Correct formula for estimating line length with -wn option</b></dt>
<dd>

<p>A formula used to estimating maximum line length when the -wn option is set was missing a term for continuation indentation. No actual changes in formatting have been seen. This update made 12 Jan 2021.</p>

</dd>
<dt id="Fixed-unusual-blinker-related-to-large--ci-and--mft-n"><b>Fixed unusual blinker related to large -ci and -mft=n</b></dt>
<dd>

<p>The following blinker was found in random testing. The following statement (with @j starting at level 0)</p>

<pre><code>    @j = ( $x, $y, $z );</code></pre>

<p>run with the following parameters</p>

<pre><code>    --indent-columns=5
    --continuation-indentation=7
    --maximum-line-length=20
    --break-before-paren-and-indent=2
    --break-before-paren=2
    --maximum-fields-per-table=4</code></pre>

<p>caused an oscillation between two states. An unusual feature which contributed to the problem is the very large ci value. This is fixed in a patch made 12 Jan 2021, 9a97dba.</p>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20201207">Issues fixed after release 20201207</h1>

<dl>

<dt id="Improve-indentation-of-multiline-qw-quotes-when--xci-flag-is-set"><b>Improve indentation of multiline qw quotes when -xci flag is set</b></dt>
<dd>

<p>The indentation of multiline qw quotes runs into problems when there is nesting, as in the following.</p>

<pre><code>    # OLD: perltidy -xci -ci=4
    for my $feep (
        qw{
        pwage      pwchange   pwclass    pwcomment
        pwexpire   pwgecos    pwpasswd   pwquota
        }
        )</code></pre>

<p>The problem is that multiline qw quotes do not get the same indentation treatment as lists.</p>

<p>This update fixes this in the following circumstances:</p>

<pre><code>  - the leading qw( and trailing ) are on separate lines
  - the closing token is one of ) } ] &gt;
  - the -xci flag is set</code></pre>

<p>The above example becomes</p>

<pre><code>    # NEW: perltidy -xci -ci=4
    for my $feep (
        qw{
            pwage      pwchange   pwclass    pwcomment
            pwexpire   pwgecos    pwpasswd   pwquota
        }
        )</code></pre>

<p>The reason that the -xci flag is required is to minimize unexpected changes to existing scripts. The extra indentation is removed if the -wn flag is also given, so both old and new versions with -wn give</p>

<pre><code>    # OLD and NEW: perltidy -wn -xci -ci=4
    for my $feep ( qw{
        pwage      pwchange   pwclass    pwcomment
        pwexpire   pwgecos    pwpasswd   pwquota
    } )</code></pre>

<p>This update added 8 Jan 2021, 474cfa8.</p>

</dd>
<dt id="Improve-alignment-of-leading-equals-in-rare-situation"><b>Improve alignment of leading equals in rare situation</b></dt>
<dd>

<p>A rare case in which a vertical alignment opportunity of leading equals was missed has been fixed. This involved lines with additional varying alignment tokens, such as &#39;unless&#39; and second &#39;=&#39; in lines 1-3 below. In this example lines 4 and 5 were not &#39;looking&#39; backwards to align their leading equals.</p>

<pre><code>    # OLD:
    $them = &#39;localhost&#39; unless ( $them = shift );
    $cmd  = &#39;!print&#39;    unless ( $cmd  = shift );
    $port = 2345        unless ( $port = shift );
    $saddr = &#39;S n a4 x8&#39;;
    $SIG{&#39;INT&#39;} = &#39;dokill&#39;;

    # NEW
    $them       = &#39;localhost&#39; unless ( $them = shift );
    $cmd        = &#39;!print&#39;    unless ( $cmd  = shift );
    $port       = 2345        unless ( $port = shift );
    $saddr      = &#39;S n a4 x8&#39;;
    $SIG{&#39;INT&#39;} = &#39;dokill&#39;;</code></pre>

<p>Fixed 5 Jan 2021, 9244678.</p>

</dd>
<dt id="Moved-previous-patch-to-a-better-location"><b>Moved previous patch to a better location</b></dt>
<dd>

<p>The previous patch was moved to a location where it only applies if there is a side comment on the line with a closing token. This minimizes changes to other side comment locations.</p>

</dd>
<dt id="Further-improvement-in-rules-for-forgetting-last-side-comment-location"><b>Further improvement in rules for forgetting last side comment location</b></dt>
<dd>

<p>The code for forgetting the last side comment location was rewritten to improve formatting in some edge cases. The update also fixes a very rare problem discovered during testing and illustrated with the following snippet. The problem occurs for the particular combination of parameters -sct -act=2 and when a closing paren has a side comment:</p>

<pre><code>    OLD: perltidy -sct -act=2
    foreach $line (
        [0, 1, 2], [3, 4, 5], [6, 7, 8],    # rows
        [0, 3, 6], [1, 4, 7], [2, 5, 8],    # columns
        [0, 4, 8], [2, 4, 6])                                     # diagonals

    NEW: perltidy -sct -act=2
    foreach $line (
        [0, 1, 2], [3, 4, 5], [6, 7, 8],    # rows
        [0, 3, 6], [1, 4, 7], [2, 5, 8],    # columns
        [0, 4, 8], [2, 4, 6])    # diagonals</code></pre>

<p>In the old version the last side comment was aligned before the closing paren was attached to the previous line, causing the final side comment to be far to the right. A patch in the new version just places it at the default location. This is the best than can be done for now, but is preferable to the old formatting. 3 Jan 2021, e57d8db.</p>

</dd>
<dt id="Improve-rule-for-forgetting-last-side-comment-location"><b>Improve rule for forgetting last side comment location</b></dt>
<dd>

<p>The code which aligns side comments remembers the most recent side comment and in some cases tries to start aligning at that column for later side comments. Sometimes the old side comment column was being remembered too long, causing occasional poor formatting and causing a noticeable and unexpected drift of side comment locations to the right. The rule for forgetting the previous side comment column has been modified to reduce this problem. The new rule is essentially to forget the previous side comment location at a new side comment with different indentation level or significant number of lines without side comments (about 12). The previous implementation forgetting changes in indentation level across code blocks only. Below is an example where the old method gets into trouble and the new method is ok:</p>

<pre><code>        # OLD:
        foreach my $r (@$array) {
            $Dat{Data}{ uc $r-&gt;[0] } = join( &quot;;&quot;, @$r );    # store all info
            my $name = $Dat{GivenName}{ uc $r-&gt;[0] } || $r-&gt;[1];

            # pass array as ad-hoc string, mark missing values
            $Dat{Data}{ uc $r-&gt;[0] } = join(
                &quot;;&quot;,
                (
                    uc $r-&gt;[0], uc $name,                   # symbol, name
                    $r-&gt;[2],    $r-&gt;[3], $r-&gt;[4],           # price, date, time
                    $r-&gt;[5],    $r-&gt;[6],                    # change, %change
                    $r-&gt;[7],    &quot;-&quot;, &quot;-&quot;, &quot;-&quot;,    # vol, avg vol, bid,ask
                    $r-&gt;[8],               $r-&gt;[9],     # previous, open
                    &quot;$r-&gt;[10] - $r-&gt;[11]&quot;, $r-&gt;[12],    # day range,year range,
                    &quot;-&quot;,                   &quot;-&quot;, &quot;-&quot;, &quot;-&quot;, &quot;-&quot;
                )
            );                                          # eps,p/e,div,yld,cap
        }</code></pre>

<p>The second side comment is at a deeper indentation level but was not being forgotten, causing line length limits to interfere with later alignment. The new rule gives a better result:</p>

<pre><code>        # NEW:
        foreach my $r (@$array) {
            $Dat{Data}{ uc $r-&gt;[0] } = join( &quot;;&quot;, @$r );    # store all info
            my $name = $Dat{GivenName}{ uc $r-&gt;[0] } || $r-&gt;[1];

            # pass array as ad-hoc string, mark missing values
            $Dat{Data}{ uc $r-&gt;[0] } = join(
                &quot;;&quot;,
                (
                    uc $r-&gt;[0], uc $name,               # symbol, name
                    $r-&gt;[2],    $r-&gt;[3], $r-&gt;[4],       # price, date, time
                    $r-&gt;[5],    $r-&gt;[6],                # change, %change
                    $r-&gt;[7],    &quot;-&quot;, &quot;-&quot;, &quot;-&quot;,          # vol, avg vol, bid,ask
                    $r-&gt;[8],               $r-&gt;[9],     # previous, open
                    &quot;$r-&gt;[10] - $r-&gt;[11]&quot;, $r-&gt;[12],    # day range,year range,
                    &quot;-&quot;,                   &quot;-&quot;, &quot;-&quot;, &quot;-&quot;, &quot;-&quot;
                )
            );    # eps,p/e,div,yld,cap
        }</code></pre>

<p>The following exampel shows an unexpected alignment in the cascade of trailing comments which are aligned but slowly separating from their closing containers:</p>

<pre><code>    # OLD:
    {
        $a = [
            Cascade    =&gt; $menu_cb,
            -menuitems =&gt; [
                [ Checkbutton =&gt; &#39;Oil checked&#39;, -variable =&gt; \$OIL ],
                [
                    Button   =&gt; &#39;See current values&#39;,
                    -command =&gt; [
                        \&amp;see_vars, $TOP,

                    ],    # end see_vars
                ],        # end button
            ],            # end checkbutton menuitems
        ];                # end checkbuttons cascade
    }</code></pre>

<p>This was caused by forgetting side comments only across code block changes. The new result is more reasonable:</p>

<pre><code>    # NEW:
    {
        $a = [
            Cascade    =&gt; $menu_cb,
            -menuitems =&gt; [
                [ Checkbutton =&gt; &#39;Oil checked&#39;, -variable =&gt; \$OIL ],
                [
                    Button   =&gt; &#39;See current values&#39;,
                    -command =&gt; [
                        \&amp;see_vars, $TOP,

                    ],    # end see_vars
                ],    # end button
            ],    # end checkbutton menuitems
        ];    # end checkbuttons cascade
    }</code></pre>

<p>This change will cause occasional differences in side comment locations from previous versions but overall it gives fewer unexpected results so it is a worthwhile change. 29-Dec-2020, 76993f4.</p>

</dd>
<dt id="Fixed-very-minor-inconsistency-in-redefining-lists-after-prune-step"><b>Fixed very minor inconsistency in redefining lists after prune step</b></dt>
<dd>

<p>In rare cases it is necessary to update the type of lists, and this influences vertical alignment. This update fixes a minor inconsistency in doing this. In some rare cases with complex list elements vertical alignment can be improved. 27 Dec, 2020, 751faec.</p>

<pre><code>            # OLD
            return join( &#39;&#39;,
                $pre,   &#39;&lt;IMG &#39;,   $iconsizes{$alt} || &#39;&#39;,
                $align, &#39;BORDER=&#39;, $nav_border,
                &#39; ALT=&quot;&#39;, $alt,        &quot;\&quot;\n&quot;,
                &#39; SRC=&quot;&#39;, $ICONSERVER, &quot;/$icon&quot;,
                &#39;&quot;&gt;&#39; );

            # NEW
            return join( &#39;&#39;,
                $pre,     &#39;&lt;IMG &#39;,     $iconsizes{$alt} || &#39;&#39;,
                $align,   &#39;BORDER=&#39;,   $nav_border,
                &#39; ALT=&quot;&#39;, $alt,        &quot;\&quot;\n&quot;,
                &#39; SRC=&quot;&#39;, $ICONSERVER, &quot;/$icon&quot;,
                &#39;&quot;&gt;&#39; );</code></pre>

</dd>
<dt id="Improved-vertical-alignment-of-some-edge-cases"><b>Improved vertical alignment of some edge cases</b></dt>
<dd>

<p>The existing rules for aligning two lines with very different lengths were rejecting some good alignments, such as the first line of numbers in the example below:</p>

<pre><code>    # OLD:
    @gg_3 = (
        [
            0.0, 1.360755E-2, 9.569446E-4, 9.569446E-4,
            1.043498E-3, 1.043498E-3
        ],
        [
            9.569446E-4, 9.569446E-4, 0.0, 7.065964E-5,
            1.422811E-4, 1.422811E-4
        ],
        ...
    );

    # NEW:
    @gg_3 = (
        [
            0.0,         1.360755E-2, 9.569446E-4, 9.569446E-4,
            1.043498E-3, 1.043498E-3
        ],
        [
            9.569446E-4, 9.569446E-4, 0.0, 7.065964E-5,
            1.422811E-4, 1.422811E-4
        ],
        ...
    );</code></pre>

<p>The rule in sub &#39;two_line_pad&#39; was updated to allow alignment of any lists if the patterns match exactly (all numbers in this case). Updated 27-Dec-2020, 035d2b7.</p>

</dd>
<dt id="Avoid--lp-style-formatting-of-lists-containing-multiline-qw-quotes"><b>Avoid -lp style formatting of lists containing multiline qw quotes</b></dt>
<dd>

<p>The -lp formatting style often does not work well when lists contain multiline qw quotes. This update avoids this problem by not formatting such lists with the -lp style. For example,</p>

<pre><code>    # OLD, perltidy -gnu
    @EXPORT = (
        qw(
          i Re Im rho theta arg
          sqrt log ln
          log10 logn cbrt root
          cplx cplxe
          ),
        @trig,
              );


    # NEW, perltidy -gnu
    @EXPORT = (
        qw(
          i Re Im rho theta arg
          sqrt log ln
          log10 logn cbrt root
          cplx cplxe
        ),
        @trig,
    );</code></pre>

<p>27-Dec-2020, 948c9bd.</p>

</dd>
<dt id="improve-formatting-of-multiline-qw"><b>improve formatting of multiline qw</b></dt>
<dd>

<p>This update adds a sequence numbering system for multiline qw quotes. In the perltidy tokenizer normal container pair types, like { }, (), [], are given unique serial numbers which are used as keys to data structures. qw quoted lists do not get serial numbers by the tokenizer, so this update creates a separate serial number scheme for them to correct this problem. One formatting problem that this solves is that of preventing the closing token of a multiline quote from being outdented more than the opening token. This is a general formatting rule which should be followed. Without a sequence number, the closing qw token could not lookup its corresponding opening indentation so it had to resort to a default, breaking the rule, as in the following:</p>

<pre><code>    # OLD, perltidy -wn
    # qw line
    if ( $pos == 0 ) {
        @return = grep( /^$word/,
            sort qw(
              ! a b d h i m o q r u autobundle clean
              make test install force reload look
        ) ); #&lt;-- outdented more than &#39;sort&#39;
    }

    # Here is the same with a list instead of a qw; note how the
    # closing sort paren does not outdent more than the &#39;sort&#39; line.
    # This is the desired result for qw.
    # perltidy -wn
    if ( $pos == 0 ) {
        @return = grep( /^$word/,
            sort (

                &#39;!&#39;,          &#39;a&#39;, &#39;b&#39;, &#39;d&#39;, &#39;h&#39;, &#39;i&#39;, &#39;m&#39;, &#39;o&#39;, &#39;q&#39;, &#39;r&#39;, &#39;u&#39;,
                &#39;autobundle&#39;, &#39;clean&#39;,
                &#39;make&#39;,       &#39;test&#39;, &#39;install&#39;, &#39;force&#39;, &#39;reload&#39;, &#39;look&#39;
            ) );  #&lt;-- not outdented more than &#39;sort&#39;
    }

    # NEW (perltidy -wn)
    if ( $pos == 0 ) {
        @return = grep( /^$word/,
            sort qw(
              ! a b d h i m o q r u autobundle clean
              make test install force reload look
            ) ); #&lt;-- not outdented more than sort
    }</code></pre>

<p>Here is another example # OLD: $_-&gt;meta-&gt;make_immutable( inline_constructor =&gt; 0, constructor_name =&gt; &quot;_new&quot;, inline_accessors =&gt; 0, ) for qw( Class::XYZ::Package Class::XYZ::Module Class::XYZ::Class</p>

<pre><code>        Class::XYZ::Overload
    );  #&lt;-- outdented more than the line with &#39;for qw(&#39;

    # NEW:
    $_-&gt;meta-&gt;make_immutable(
        inline_constructor =&gt; 0,
        constructor_name   =&gt; &quot;_new&quot;,
        inline_accessors   =&gt; 0,
      )
      for qw(
      Class::XYZ::Package
      Class::XYZ::Module
      Class::XYZ::Class

      Class::XYZ::Overload
      ); #&lt;-- outdented same as the line with &#39;for qw(&#39;</code></pre>

<p>26 Dec 2020, cdbf0e4.</p>

</dd>
<dt id="improve-list-marking-method"><b>improve list marking method</b></dt>
<dd>

<p>In the process of making vertical alignments, lines which are simple lists of items are treated different from other lines. The old method for finding and marking these lines had a few problems which are corrected with this update. The main problem was that the old method ran into trouble when there were side comments. For example, the old method was not marking the following list and as a result the two columns of values were not aligned:</p>

<pre><code>    # OLD
    return (
        $startpos, $ldelpos - $startpos,         # PREFIX
        $ldelpos,  1,                            # OPENING BRACKET
        $ldelpos + 1, $endpos - $ldelpos - 2,    # CONTENTS
        $endpos - 1, 1,                          # CLOSING BRACKET
        $endpos, length($$textref) - $endpos,    # REMAINDER
    );

    # NEW
    return (
        $startpos,    $ldelpos - $startpos,           # PREFIX
        $ldelpos,     1,                              # OPENING BRACKET
        $ldelpos + 1, $endpos - $ldelpos - 2,         # CONTENTS
        $endpos - 1,  1,                              # CLOSING BRACKET
        $endpos,      length($$textref) - $endpos,    # REMAINDER
    );</code></pre>

<p>Another problem was that occasionally unwanted alignments were made between lines which were not really lists because the lines were incorrectly marked. For example (note padding after first comma)</p>

<pre><code>    # OLD: (undesirable alignment)
    my ( $isig2, $chisq ) = ( 1 / ( $sig * $sig ), 0 );
    my ( $ym,    $al, $cov, $bet, $olda, $ochisq, $di, $pivt, $info ) =
      map { null } ( 0 .. 8 );

    # NEW: (no alignment)
    my ( $isig2, $chisq ) = ( 1 / ( $sig * $sig ), 0 );
    my ( $ym, $al, $cov, $bet, $olda, $ochisq, $di, $pivt, $info ) =
      map { null } ( 0 .. 8 );</code></pre>

<p>This update was made 22 Dec 2020, 36d4c35.</p>

</dd>
<dt id="Fix-git-51-closing-quote-pattern-delimiters-not-following--cti-flag-settings"><b>Fix git #51, closing quote pattern delimiters not following -cti flag settings</b></dt>
<dd>

<p>Closing pattern delimiter tokens of qw quotes were not following the -cti flag settings for containers in all cases, as would be expected, in particular when followed by a comma. For example, the closing qw paren below was indented with continuation indentation but would not have that extra indentation if it followed the default -cpi setting for a paren:</p>

<pre><code>    # OLD:
    @EXPORT = (
        qw(
          i Re Im rho theta arg
          sqrt log ln
          log10 logn cbrt root
          cplx cplxe
          ),
        @trig
    );

    # NEW
    @EXPORT = (
        qw(
            i Re Im rho theta arg
            sqrt log ln
            log10 logn cbrt root
            cplx cplxe
        ),
        @trig
    );</code></pre>

<p>This update makes closing qw quote terminators follow the settings for their corresponding container tokens as closely as possible. For a closing &#39;&gt;&#39; the setting for a closing paren will now be followed. Other closing qw terminators will remain indented, to minimize changes to existing formatting. For example (&#39;&gt;&#39; is outdented):</p>

<pre><code>    @EXPORT = (
        qw&lt;
          i Re Im rho theta arg
          sqrt log ln
          log10 logn cbrt root
          cplx cplxe
        &gt;,
        @trig
    );</code></pre>

<p>but (&#39;;&#39; remains indented):</p>

<pre><code>    @EXPORT = (
        qw;
          i Re Im rho theta arg
          sqrt log ln
          log10 logn cbrt root
          cplx cplxe
          ;,
        @trig
    );</code></pre>

<p>This update was added 18 Dec 2020 and modified 24 Dec 2020, 538688f.</p>

</dd>
<dt id="Update-manual-pages-regarding-issue-git-50"><b>Update manual pages regarding issue git #50</b></dt>
<dd>

<p>Additional wording was added to the man pages regarding situations in which perltidy does not change whitespace. This update was added 17 Dec 2020.</p>

</dd>
<dt id="Rewrote-sub-check_match"><b>Rewrote sub check_match</b></dt>
<dd>

<p>Moved inner part of sub check_match into sub match_line_pair in order to make info available earlier. This gave some minor alignment improvements. This was done 16 Dec 2020, 7ba4f3b.</p>

<pre><code>    # OLD:
    @tests = (
        @common,     &#39;$_&#39;,
        &#39;&quot;\$_&quot;&#39;,     &#39;@_&#39;,
        &#39;&quot;\@_&quot;&#39;,     &#39;??N&#39;,
        &#39;&quot;??N&quot;&#39;,     chr 256,
        &#39;&quot;\x{100}&quot;&#39;, chr 65536,
        &#39;&quot;\x{10000}&quot;&#39;, ord &#39;N&#39; == 78 ? ( chr 11, &#39;&quot;\013&quot;&#39; ) : ()
    );

    # NEW:
    @tests = (
        @common,       &#39;$_&#39;,
        &#39;&quot;\$_&quot;&#39;,       &#39;@_&#39;,
        &#39;&quot;\@_&quot;&#39;,       &#39;??N&#39;,
        &#39;&quot;??N&quot;&#39;,       chr 256,
        &#39;&quot;\x{100}&quot;&#39;,   chr 65536,
        &#39;&quot;\x{10000}&quot;&#39;, ord &#39;N&#39; == 78 ? ( chr 11, &#39;&quot;\013&quot;&#39; ) : ()
    );</code></pre>

</dd>
<dt id="Improved-vertical-alignments-by-avoiding-pruning-step"><b>Improved vertical alignments by avoiding pruning step</b></dt>
<dd>

<p>There is a step in vertical alignment where the alignments are formed into a tree with different levels, and some deeper levels are pruned to preserve lower level alignments. This usually works well, but some deeper alignments will be lost, which is what was happening in the example below. It turns out that if the tree pruning is skipped when alignment depths increase monotonically across lines, as in the example, then better overall alignment is achieved by the subsequent &#39;sweep&#39; pass.</p>

<pre><code>    # OLD
    my $cmd = shift @ARGV;
    if    ( $cmd eq &quot;new&quot; )         { $force_new = 1; }
    elsif ( $cmd eq &quot;interactive&quot; ) { $interactive = 1; $batch       = 0; }
    elsif ( $cmd eq &quot;batch&quot; )       { $batch       = 1; $interactive = 0; }
    elsif ( $cmd eq &quot;use_old&quot; )     { $use_old = 1; }
    elsif ( $cmd eq &quot;show&quot; )        { $show    = 1; last; }
    elsif ( $cmd eq &quot;showall&quot; )     { $showall = 1; last; }
    elsif ( $cmd eq &quot;show_all&quot; )    { $showall = 1; last; }
    elsif ( $cmd eq &quot;remove&quot; )      { $remove  = 1; last; }
    elsif ( $cmd eq &quot;help&quot; )        { $help    = 1; last; }

    # NEW
    my $cmd = shift @ARGV;
    if    ( $cmd eq &quot;new&quot; )         { $force_new   = 1; }
    elsif ( $cmd eq &quot;interactive&quot; ) { $interactive = 1; $batch       = 0; }
    elsif ( $cmd eq &quot;batch&quot; )       { $batch       = 1; $interactive = 0; }
    elsif ( $cmd eq &quot;use_old&quot; )     { $use_old     = 1; }
    elsif ( $cmd eq &quot;show&quot; )        { $show        = 1; last; }
    elsif ( $cmd eq &quot;showall&quot; )     { $showall     = 1; last; }
    elsif ( $cmd eq &quot;show_all&quot; )    { $showall     = 1; last; }
    elsif ( $cmd eq &quot;remove&quot; )      { $remove      = 1; last; }
    elsif ( $cmd eq &quot;help&quot; )        { $help        = 1; last; }</code></pre>

<p>This update was made 14 Dec 2020, 44e0afa.</p>

</dd>
<dt id="Improved-some-marginal-vertical-alignments"><b>Improved some marginal vertical alignments</b></dt>
<dd>

<p>This update fixed a rare situation in which some vertical alignment was missed. The problem had to do with two lines being incorrectly marked as a marginal match. A new routine, &#39;match_line_pairs&#39; was added to set a flag with the information needed to detect and prevent this. This fix was made 13 Dec 2020, 9a8e49b.</p>

<pre><code>    # OLD
    $sec = $sec + ( 60 * $min );
    $graphcpu[$sec] = $line;
    $secmax  = $sec  if ( $sec &gt; $secmax );
    $linemax = $line if ( $line &gt; $linemax );

    # NEW
    $sec            = $sec + ( 60 * $min );
    $graphcpu[$sec] = $line;
    $secmax         = $sec  if ( $sec &gt; $secmax );
    $linemax        = $line if ( $line &gt; $linemax );</code></pre>

</dd>
<dt id="Do-not-align-equals-across-changes-in-continuation-indentation"><b>Do not align equals across changes in continuation indentation</b></dt>
<dd>

<p>A rule was added to prevent vertical alignment of lines with leading &#39;=&#39; across a change in continuation indentation. Sometimes aligning across a change in CI can come out okay, but sometimes it can be very poor. For example:</p>

<pre><code>    # BAD:
    $!               = 2, die qq/$0: can&#39;t stat -${arg}&#39;s &quot;$file&quot;./
        unless $time = ( stat($file) )[$STAT_MTIME];

    # FIXED:
    $! = 2, die qq/$0: can&#39;t stat -${arg}&#39;s &quot;$file&quot;./
      unless $time = ( stat($file) )[$STAT_MTIME];</code></pre>

<p>The second line is a continuation of the first, and this update prevents this alignment. The above &#39;BAD&#39; formatting was in the previous developmental version of perltidy, not the previous release. This update added 12 Dec 2020, 5b56147.</p>

</dd>
<dt id="Improve-vertical-alignment-in-some-two-line-matches"><b>Improve vertical alignment in some two-line matches</b></dt>
<dd>

<p>When two lines would be perfectly aligned except for the line length limit, previously they would only be aligned if they had a common leading equals. The update removes this restriction and allows as many alignments to be made as possible. The results are generally improved. This update was made 11 Dec 2020, f3c6cd8. Some examples:</p>

<p># In this example the side comments were limiting the matches</p>

<pre><code>    # OLD
    shift @data if @data and $data[0] =~ /Contributed\s+Perl/;    # Skip header
    pop @data if @data and $data[-1] =~ /^\w/;    # Skip footer, like

    # NEW
    shift @data if @data and $data[0]  =~ /Contributed\s+Perl/;    # Skip header
    pop @data   if @data and $data[-1] =~ /^\w/;    # Skip footer, like</code></pre>

<p># The same is true here.</p>

<pre><code>    # OLD
    if ($tvg::o_span) { $tvg::hour_span = $tvg::o_span; }
    if ( $tvg::hour_span % 2 &gt; 0 ) { $tvg::hour_span++; }    # Multiple of 2

    # NEW
    if ($tvg::o_span)              { $tvg::hour_span = $tvg::o_span; }
    if ( $tvg::hour_span % 2 &gt; 0 ) { $tvg::hour_span++; }    # Multiple of 2</code></pre>

<p>In the next example, the first comma is now aligned but not the second, because of the line length limit:</p>

<pre><code>    # OLD
    is( MyClass-&gt;meta, $mc, &#39;... these metas are still the same thing&#39; );
    is( MyClass-&gt;meta-&gt;meta, $mc-&gt;meta, &#39;... these meta-metas are the same thing&#39; );

    # NEW
    is( MyClass-&gt;meta,       $mc, &#39;... these metas are still the same thing&#39; );
    is( MyClass-&gt;meta-&gt;meta, $mc-&gt;meta, &#39;... these meta-metas are the same thing&#39; );</code></pre>

<p>In this last example, the first comma is not aligned, but alignment resumes after the second comma.</p>

<pre><code>    # OLD
    is( $obj-&gt;name, $COMPRESS_FILE, &quot;   Name now set to &#39;$COMPRESS_FILE&#39;&quot; );
    is( $obj-&gt;prefix, &#39;&#39;, &quot;   Prefix now empty&quot; );

    # NEW
    is( $obj-&gt;name, $COMPRESS_FILE, &quot;   Name now set to &#39;$COMPRESS_FILE&#39;&quot; );
    is( $obj-&gt;prefix, &#39;&#39;,           &quot;   Prefix now empty&quot; );</code></pre>

</dd>
<dt id="Improve-vertical-alignment-in-some-marginal-matches"><b>Improve vertical alignment in some marginal matches</b></dt>
<dd>

<p>In perltidy a &#39;marginal match&#39; occurs for example when two lines share some alignment tokens but are somewhat different. When this happens some limits are placed on the size of the padding spaces that can be introduced. In this update the amount of allowed padding is significantly increased for certain &#39;good&#39; alignment tokens. Results of extensive testing were favorable provided that the change is restricted to alignments of &#39;=&#39;, &#39;if&#39; and &#39;unless&#39;. Update made 10 Dec 2020, a585f0b.</p>

<pre><code>    # OLD
    my @roles = $self-&gt;role_names;
    my $role_names = join &quot;|&quot;, @roles;

    # NEW
    my @roles      = $self-&gt;role_names;
    my $role_names = join &quot;|&quot;, @roles;

    # OLD
    $sysname .= &#39;del&#39; if $self-&gt;label =~ /deletion/;
    $sysname .= &#39;ins&#39; if $self-&gt;label =~ /insertion/;
    $sysname .= uc $self-&gt;allele_ori-&gt;seq if $self-&gt;allele_ori-&gt;seq;

    # NEW
    $sysname .= &#39;del&#39;                     if $self-&gt;label =~ /deletion/;
    $sysname .= &#39;ins&#39;                     if $self-&gt;label =~ /insertion/;
    $sysname .= uc $self-&gt;allele_ori-&gt;seq if $self-&gt;allele_ori-&gt;seq;</code></pre>

</dd>
<dt id="Improve-vertical-alignment-of-lines-ending-in-fat-comma"><b>Improve vertical alignment of lines ending in fat comma</b></dt>
<dd>

<p>A minor adjustment was made to the rule for aligning lines which end in &#39;=&gt;&#39;. When there are just two lines in an alignment group, the alignment is avoided if the first of the two ends in a &#39;=&gt;&#39;. Previously, alignment was avoided if either ended in a &#39;=&gt;&#39;. The old rule was preventing some good alignments in a later stage of the iteration. In the following example, the last two lines are processed separately because they do not match the comma in &#39;sprintf&#39;. The new rule allows the fat comma alignment to eventually get made later in the iteration. Update made 9 Dec 2020, ca0ddf4.</p>

<pre><code>    # OLD
    $template-&gt;param(
        classlist =&gt; $classlist,
        ...,
        suggestion =&gt; $suggestion,
        totspent   =&gt; sprintf( &quot;%.2f&quot;, $totspent ),
        totcomtd   =&gt; sprintf( &quot;%.2f&quot;, $totcomtd ),
        totavail   =&gt; sprintf( &quot;%.2f&quot;, $totavail ),
        nobudget =&gt; $#results == -1 ? 1 : 0,
        intranetcolorstylesheet =&gt;
          C4::Context-&gt;preference(&quot;intranetcolorstylesheet&quot;),
        ...
    );

    # NEW
    $template-&gt;param(
        classlist =&gt; $classlist,
        ...,
        suggestion              =&gt; $suggestion,
        totspent                =&gt; sprintf( &quot;%.2f&quot;, $totspent ),
        totcomtd                =&gt; sprintf( &quot;%.2f&quot;, $totcomtd ),
        totavail                =&gt; sprintf( &quot;%.2f&quot;, $totavail ),
        nobudget                =&gt; $#results == -1 ? 1 : 0,
        intranetcolorstylesheet =&gt;
          C4::Context-&gt;preference(&quot;intranetcolorstylesheet&quot;),
        ...
    );</code></pre>

</dd>
<dt id="Avoid-processing-a-file-more-than-once"><b>Avoid processing a file more than once</b></dt>
<dd>

<p>In the unlikely event that a user enters a filename more than once on the command line to perltidy, as for &#39;file1.pl&#39; here</p>

<pre><code>  perltidy file1.pl file1.pl </code></pre>

<p>then that file will be processed more than once. This looks harmless, but if the user was also using the -b (backup) parameter, then the original backup would be overwritten, which is not good. To avoid this, a filter has been placed on the list of files to remove duplicates. 9 Dec 2020, 646a542.</p>

</dd>
<dt id="Fix-for-issue-git-49-exit-status-not-correctly-set"><b>Fix for issue git #49, exit status not correctly set</b></dt>
<dd>

<p>The exit status flag was not being set for the -w option if the -se or if the -q flag were set. Issue git #44 was similar but a special case of the problem. The problem was fixed 8 Dec 2020, cb6028f.</p>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20201202">Issues fixed after release 20201202</h1>

<dl>

<dt id="Fix-for-issue-git-47"><b>Fix for issue git #47</b></dt>
<dd>

<p>This issue has to do with the --weld-nested-containers option in the specific case of formatting a function which returns a list of anonymous subs. For example</p>

<pre><code>    $promises[$i]-&gt;then(
        sub { $all-&gt;resolve(@_); () },
        sub {
            $results-&gt;[$i] = [@_];
            $all-&gt;reject(@$results) if --$remaining &lt;= 0;
            return ();
        }
    );</code></pre>

<p>A bug introduced in v20201202 caused an incorrect welding to occur when the -wn flag was set</p>

<pre><code>    $promises[$i]-&gt;then( sub { $all-&gt;resolve(@_); () },
        sub {
        $results-&gt;[$i] = [@_];
        $all-&gt;reject(@$results) if --$remaining &lt;= 0;
        return ();
        } );</code></pre>

<p>This bug has been fixed, and code which has been incorrectly formatted will be correctly formatted with the next release. The bug was a result of a new coding introduced in v20201202 for fixing some issues with parsing sub signatures. Previously they were sometimes parsed the same as prototypes and sometimes as lists, now they are always parsed as lists. Fixed 6 Dec 2020, 6fd0c4f.</p>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20201001">Issues fixed after release 20201001</h1>

<dl>

<dt id="removed-excess-spaces-in-a-package-declaration"><b>removed excess spaces in a package declaration</b></dt>
<dd>

<p>Testing revealed that for a line such as</p>

<pre><code>   package        Bob::Dog;</code></pre>

<p>which has extra spaces or even tabs after the keyword &#39;package&#39;, the extra spaces or tabs were not being removed. This was fixed 28 Nov 2020, 008443d. The line now formats to</p>

<pre><code>    package Bob::Dog;</code></pre>

</dd>
<dt id="do-not-automatically-delete-closing-side-comments-with---indent-only"><b>do not automatically delete closing side comments with --indent-only</b></dt>
<dd>

<p>For the parameter combination --indent-only and --closing-side-comments, old closing side comments were getting deleted but new closing side comments were not made. A fix was made to prevent this deletion. This fix was made 27 Nov 2020, 957e0ca.</p>

</dd>
<dt id="fix-to-stop-at-1-iteration-when-using---indent-only"><b>fix to stop at 1 iteration when using --indent-only</b></dt>
<dd>

<p>Previously, for the combination --indent-only and -conv, two iterations would be done. Only one iteration is necessary in this case. Fix made 23 Nov 2020, ae493d8.</p>

</dd>
<dt id="fix-for-formatting-signed-numbers-with-spaces"><b>fix for formatting signed numbers with spaces</b></dt>
<dd>

<p>In developing an improved convergence test, an issue slowing convergence was found related to signed numbers as in the following line,</p>

<pre><code>    @london = (deg2rad(-  0.5), deg2rad(90 - 51.3));</code></pre>

<p>The leading &#39;-&#39; here is separated from the following number &#39;0.5&#39;. This is handled by tokenizing the minus as type &#39;m&#39; and the number as type &#39;n&#39;. The whitespace between them is removed in formatting, and so the space is gone in the output. But a little problem is that the default rule for placing spaces within the parens is based on the token count, after the first formatting the result is</p>

<pre><code>    @london = ( deg2rad( -0.5 ), deg2rad( 90 - 51.3 ) );</code></pre>

<p>The next time it is formatted, the &#39;-0.5&#39; counts as one token, resulting in</p>

<pre><code>    @london = ( deg2rad(-0.5), deg2rad( 90 - 51.3 ) );</code></pre>

<p>Notice that the space within the parens around the &#39;-0.5&#39; is gone. An update was made to fix this, so that the final state is reached in one step. This fix was made 23 Nov 2020, f477c8b.</p>

</dd>
<dt id="fix-to-prevent-conversion-of-a-block-comment-to-hanging-side-comment"><b>fix to prevent conversion of a block comment to hanging side comment</b></dt>
<dd>

<p>A rare situation was identified during testing in which a block comment could be converted to be a hanging side comment. For example:</p>

<pre><code>    sub macro_get_names {    #
    #
    # %name = macro_get_names();  (key=macrohandle, value=macroname)
    #
        local (%name) = ();
        ...
    }</code></pre>

<p>For the following specific contitions the block comment in line 2 could be converted into a hanging side comment, which is undesirable:</p>

<pre><code>   1. The line contains nothing except for a &#39;#&#39; with no leading space
   2. It follows a line with side comment
   3. It has indentation level &gt; 0</code></pre>

<p>An update was made to prevent this from happening. There are two cases, depending on the value of --maximum-consecutive-blank-lines, or -mbl. If this value is positive (the default) then a blank line is inserted above the block comment to prevent it from becoming a hanging side comment. If this -mbl is zero, then the comment is converted to be a static block comment which again prevents it from becoming a hanging side comment. This fix was made 23 Nov 2020, 2eb3de1.</p>

</dd>
<dt id="improved-convergence-test"><b>improved convergence test</b></dt>
<dd>

<p>A better test for convergence has been added. When iterations are requested, the new test will stop after the first pass if no changes in line break locations are made. Previously, at least two passes were required to verify convergnece unless the output stream had the same checksum as the input stream. Extensive testing has been made to verify the correctness of the new test. This update was made 23 Nov 2020, 29efb63.</p>

</dd>
<dt id="fixed-problem-with-vertical-alignments-involving-if-statements"><b>fixed problem with vertical alignments involving &#39;if&#39; statements</b></dt>
<dd>

<p>An update was made to break vertical alignment when a new sequence of if-like statements or ternary statements is encountered. This situation was causing a loss of alignment in some cases. For example</p>

<pre><code>  OLD:
    $m1 = 0;
    if ( $value =~ /\bset\b/i )      { $m0 = 1; }
    if ( $value =~ /\barithmetic/i ) { $m1 = 1; }
    if    ( $m0 &amp;&amp; !$m1 ) { $CONFIG[1] = 0; }
    elsif ( !$m0 &amp;&amp; $m1 ) { $CONFIG[1] = 1; }
    else                  { $ok        = 0; last; }

 NEW:
    $m1 = 0;
    if    ( $value =~ /\bset\b/i )      { $m0        = 1; }
    if    ( $value =~ /\barithmetic/i ) { $m1        = 1; }
    if    ( $m0 &amp;&amp; !$m1 )               { $CONFIG[1] = 0; }
    elsif ( !$m0 &amp;&amp; $m1 )               { $CONFIG[1] = 1; }
    else                                { $ok        = 0; last; }</code></pre>

<p>This update was made 15 Nov 2020, 2b7784d.</p>

</dd>
<dt id="added-option--wnxl-s-to-give-control-of-welding-by-the--wn-parameter"><b>added option -wnxl=s to give control of welding by the -wn parameter</b></dt>
<dd>

<p>The parameter string can restrict the types of containers which are welded. This was added 11 Nov 2020 in &#39;added -wnxl=s for control of -wn&#39;, 2e642d2.</p>

</dd>
<dt id="merged-pull-request-git-46"><b>merged pull request git #46</b></dt>
<dd>

<p>The man page gave the incorrect string for -fse. This was fixed 11 Nov 2020 in 1f9869e.</p>

</dd>
<dt id="recognize-overloaded-RPerl-operators-to-avoid-error-messages"><b>recognize overloaded RPerl operators to avoid error messages</b></dt>
<dd>

<p>RPerl uses some bareword operators which caused error messages. An update was made to avoid this problem in files containing &#39;use RPerl&#39;. This update was made 6 Nov 2020, f8bd088.</p>

</dd>
<dt id="fix-issue-git-45--wn-and--vtc-n-now-work-together"><b>fix issue git #45, -wn and -vtc=n now work together</b></dt>
<dd>

<p>When -wn was set, the -vtc=n flag was being ignored. This was a simple fix made 5 Nov 2020 in &#39;fix issue git #45, -wn and -vtc=n now work together&#39;, 1fbc381.</p>

</dd>
<dt id="implement-request-RT-133649-added-parameters--kbb-s-and--kba-s"><b>implement request RT #133649, added parameters -kbb=s and -kba=s</b></dt>
<dd>

<p>These parameters request that old breakpoints be kept before or after selected token types. For example, -kbb=&#39;=&gt;&#39; means that newlines before fat commas should be kept. This was added 4 Nov 2020.</p>

</dd>
<dt id="added-parameters--maxue-n-and-maxle-n"><b>added parameters -maxue=n and maxle=n</b></dt>
<dd>

<p>These parameters had tentatively been hardwired in the tokenizer. Now the user can control them or turn the checks off altogether.</p>

</dd>
<dt id="Fix-problem-parsing"><b>Fix problem parsing &#39;$$*&#39;</b></dt>
<dd>

<p>In random testing, an error was encountered parsing the following line</p>

<pre><code>  $self-&gt;{&quot;mod_id&quot;}=($$*1001)%(10**(rand()*6));
                       ---^
  found Number where operator expected (previous token underlined)</code></pre>

<p>The line parsed correctly with a space between the &#39;$$&#39; and the &#39;*&#39;. The problem had to do with an error in some newer code for postfix dereferencing, and this was fixed on 2 Nov 2020, &#39;fix problem scanning &#39;$$&#39;; revise call to operator_expected&#39;, 49d993b.</p>

</dd>
<dt id="Update-for-git-44-fix-exit-status-for-assert-tidy-untidy"><b>Update for git #44, fix exit status for assert-tidy/untidy</b></dt>
<dd>

<p>The exit status was always 0 for --assert-tidy if the user had turned off error messages with -quiet. This was fixed by gluesys/master in &#39;fix exit status for assert-tidy/untidy options&#39;, 625d250.</p>

</dd>
<dt id="Fixed-problem-parsing-extruded-signature"><b>Fixed problem parsing extruded signature</b></dt>
<dd>

<p>A parsing error was encountered in a test parsing the following extruded signature:</p>

<pre><code>  sub foo2
  (
  $
  first
  ,
  $
  ,
  $
  third
  )
  {
  return
  &quot;first=$first, third=$third&quot;
  ;
  }</code></pre>

<p>The second &#39;$&#39; combined with the &#39;,&#39; on the next line to form a punctuation variable. This was fixed 20 Oct 2020 in &#39;fixed problem parsing extruded signature&#39;, 9b454f6.</p>

<p>The file parses correctly now, with formatted output</p>

<pre><code>  sub foo2 ( $first, $, $third ) {
      return &quot;first=$first, third=$third&quot;;
  }</code></pre>

</dd>
<dt id="Fixed-several-uses-of-undefined-variables-found-in-testing"><b>Fixed several uses of undefined variables found in testing</b></dt>
<dd>

<p>Several instances of incorrect array indexing were found in testing and fixed. These each involved incorrectly indexing with index -1. They were found by placing undefs at the end of arrays. None of these was causing incorrect formatting. They were fixed 26 Oct 2020 in &#39;fixed several instances of incorrect array indexing&#39;, c60f694.</p>

</dd>
<dt id="Prevent-syntax-error-by-breaking-dashed-package-names"><b>Prevent syntax error by breaking dashed package names</b></dt>
<dd>

<p>In stress testing perltidy with the -extrude option, the following test snippet</p>

<pre><code>  use perl6-alpha;</code></pre>

<p>was broken into sepate lines</p>

<pre><code>  use
  perl6
  -
  alpha
  ;</code></pre>

<p>A rule was added to prevent breaking around a dash separating two barewords. Rerunning gives</p>

<pre><code>  use
  perl6-alpha
  ;</code></pre>

<p>This was fixed 26 Oct 2020 in &#39;prevent breaking package names with trailing dashes&#39;, 9234be4.</p>

</dd>
<dt id="Prevent-syntax-error-by-breaking-dashed-barewords"><b>Prevent syntax error by breaking dashed barewords</b></dt>
<dd>

<p>In stress testing perltidy with the -extrude option, using the following test snippet</p>

<pre><code>  my %var;
  {
      $var{-y}  = 1;
      $var{-q}  = 1;
      $var{-qq} = 1;
      $var{-m}  = 1;
      $var{y}   = 1;
      $var{q}   = 1;
      $var{qq}  = 1;
      $var{m}   = 1;
  }</code></pre>

<p>a syntax error was created when newlines were placed before or after the dashes. It is necessary to always keep a dash on the same line with its surrounding tokens. A rule was added to do this. The new &#39;extruded&#39; result for the above snippet is:</p>

<pre><code>  my%var
  ;
  {
  $var{-y}
  =
  1
  ;
  $var{-q}
  =
  1
  ;
  $var{-qq}
  =
  1
  ;
  $var{-m}
  =
  1
  ;
  $var{y}
  =
  1
  ;
  $var{q}
  =
  1
  ;
  $var{qq}
  =
  1
  ;
  $var{m}
  =
  1
  ;
  }</code></pre>

<p>This update was added 26 Oct 2020, &#39;prevent syntax error by breaking dashed barewords&#39;, e121cae.</p>

</dd>
<dt id="more-types-of-severe-errors-will-prevent-formatting"><b>more types of severe errors will prevent formatting</b></dt>
<dd>

<p>Files for which &#39;severe errors&#39; are found have always been output verbatim rather than being formatted. The definition of &#39;severe error&#39; has been expanded to include a final indentation level error greater than 1, more than 2 brace errors, and more than 3 &quot;unexpected token type&quot; parsing errors. The goal is to avoid formatting a non-perl script or a perl script with severe errors. So for example the following snippet has a level error of 2</p>

<pre><code>  {{{{
  }}</code></pre>

<p>was previously output with default parameters as</p>

<pre><code>  { 
      {
          {
              {}
          }</code></pre>

<p>along with an error message. But now it is just output verbatim as</p>

<pre><code>  {{{{
  }}</code></pre>

<p>along with an error message. This update was added 25 Oct 2020, &#39;avoid formatting files with more types of severe errors&#39;, 2a86f51.</p>

</dd>
<dt id="added-state-as-keyword"><b>added &#39;state&#39; as keyword</b></dt>
<dd>

<p>A statement such as the following was generating an error message at the colon:</p>

<pre><code>   state $a : shared;</code></pre>

<p>The problem was that &#39;state&#39; was not in the list of keywords. This has been fixed and the line now parses without error. The &#39;state.t&#39; test file for perl 5.31 now formats without error. This was added 18 Oct 2020 in &quot;add &#39;state&#39; as keyword&quot;, d73e15f.</p>

</dd>
<dt id="sub-signatures-no-longer-parsed-with-prototypes"><b>sub signatures no longer parsed with prototypes</b></dt>
<dd>

<p>Simple signatures (those without commas) were being parsed with code originally written for prototypes. This prevented them from being formatted with the usual formatting rules. This was changed so that all signatures are now formatted with the normal formatting rules. For example:</p>

<pre><code> # Old, input and after formatting:
 sub t123 ($list=wantarray) { $list ? &quot;list&quot; : &quot;scalar&quot; }

 # New, after formatting
 sub t123 ( $list = wantarray ) { $list ? &quot;list&quot; : &quot;scalar&quot; }</code></pre>

<p>Notice that some spaces have been introduced within the signature. Previously the contents of the parens not changed unless the parens contained a list.</p>

<p>This change introduced a problem parsing extended syntax within signatures which has been fixed. In the following snippet, the &#39;:&#39; caused a parsing error which was fixed.</p>

<pre><code>  # perltidy -sal=&#39;method&#39;
  method foo4 ( $class : $bar, $bubba ) { $class-&gt;bar($bar) }</code></pre>

<p>The &#39;:&#39; here is given a type of &#39;A&#39;. This may be used to change the spacing around it. For example:</p>

<pre><code>  # perltidy -sal=&#39;method&#39; -nwls=&#39;A&#39;
  method foo4 ( $class: $bar, $bubba ) { $class-&gt;bar($bar) }</code></pre>

<p>This update was added 18 Oct 2020, in &#39;format all signatures separately from prototypes&#39;, e6a10f3. The test file &#39;signatures.t&#39; distributed with perl5.31 formats without error now.</p>

</dd>
<dt id="fix-parsing-problem-with"><b>fix parsing problem with $#</b></dt>
<dd>

<p>A problem with parsing variables of the form $# and $#array was found in testing and fixed. For most variables the leading sigil may be separated from the remaining part of the identifier by whitespace. An exception is for a variable beginning with &#39;$#&#39;. If there is any space between the &#39;$&#39; and &#39;#&#39; then the &#39;#&#39; starts a comment. So the following snippet is has valid syntax and is equivalent to $ans=40;</p>

<pre><code>    my $ #
    #
    ans = 40;</code></pre>

<p>This was being misparsed and was fixed 17 Oct 2020, in &#39;fixed parsing error with spaces in $#&#39; a079cdb.</p>

</dd>
<dt id="fix-missing-line-break-for-hash-of-subs-with-signatures"><b>fix missing line break for hash of subs with signatures</b></dt>
<dd>

<p>During testing the following error was found and fixed. Given the following input snippet:</p>

<pre><code>    get(
        on_ready =&gt; sub ($worker) {
            $on_ready-&gt;end;
            return;
        },
        on_exit =&gt; sub ( $worker, $status ) { return; },
    );</code></pre>

<p>The resulting formatting was</p>

<pre><code>    get(
        on_ready =&gt; sub ($worker) {
            $on_ready-&gt;end;
            return;
        }, on_exit =&gt; sub ( $worker, $status ) { return; },
    );</code></pre>

<p>Notice that the break after the comma has been lost. The problem was traced to a short-cut taken by the code looking for one-line blocks. The unique circumstances in which this occurred involved a hash of anonymous subs, one with a signature with multiple parameters and short enough to be a one-line block, as in the last sub definition line. This was fixed 17 Oct 2020 in &#39;fix missing line break for hash of subs with signatures&#39;, 51428db.</p>

</dd>
<dt id="fix-issues-with-prototype-and-signature-parsing"><b>fix issues with prototype and signature parsing</b></dt>
<dd>

<p>Problems with parsing prototypes and signatures were found during testing and fixed 17 Oct 2020 in &#39;fixed problem parsing multi-line signatures with comments&#39;, 017fd07. For example the following snippet was mis-parsed because of the hash mark.</p>

<pre><code>    sub test ( # comment ))) 
        $x, $x) { $x+$y }</code></pre>

<p>Complex signature expressions such as the following are now parsed without error:</p>

<pre><code>    sub t086
        ( #foo)))
        $ #foo)))
        a #foo)))
        ) #foo)))
        { $a.$b }</code></pre>

</dd>
<dt id="improve-guess-for-pattern-or-division"><b>improve guess for pattern or division</b></dt>
<dd>

<p>The following line caused a tokenization error in which the two slashes were parsed as a pattern.</p>

<pre><code>   my $masksize = ceil( Opcode::opcodes / 8 );    # /</code></pre>

<p>This problem was discovered in random testing. When a slash follows a bareword whose prototype is not known to perltidy, it has to guess whether the slash starts a pattern or is a division. The guessing logic was rewritten and improved 14 Oct 2020 in &#39;rewrote logic to guess if divide or pattern&#39;, afebe2f.</p>

</dd>
<dt id="fix--bos-to-keep-isolated-semicolon-breaks-after-block-braces"><b>fix -bos to keep isolated semicolon breaks after block braces</b></dt>
<dd>

<p>The flag <b>-bos</b>, or <b>--break-at-old-semicolon-breakpoints</b>, keeps breaks at old isolated semicolons. For example</p>

<pre><code>    $z = sqrt($x**2 + $y**2)
      ;</code></pre>

<p>In testing it was found not to be doing this after braces which require semicolons, such as &#39;do&#39; and anonymous subs. This was fixed 12 Oct 2020 in &#39;fix -bos to work with semicolons after braces&#39;, 03ee7fc. For example</p>

<pre><code>    my $dist = sub {
        $z = sqrt( $x**2 + $y**2 )
          ;
      }
      ;</code></pre>

</dd>
<dt id="keep-break-after-use-overload"><b>keep break after &#39;use overload&#39;</b></dt>
<dd>

<p>If a line break occurs after <b>use overload</b> then it will now be kept. Previously it was dropped. For example, this would be kept intact:</p>

<pre><code>                use overload
                    &#39;+&#39; =&gt; sub {
                        print length $_[2], &quot;\n&quot;;
                        my ( $x, $y ) = _order(@_);
                        Number::Roman-&gt;new( int $x + $y );
                    },
                    &#39;-&#39; =&gt; sub {
                        my ( $x, $y ) = _order(@_);
                        Number::Roman-&gt;new( int $x - $y );
                    },
                    ...</code></pre>

<p>This keeps the list from shifting to the right and can avoid problems in formatting the list with certain styles, including with the -xci flag. Fixed 12 Oct 2020 in &#39;keep break after use overload statement&#39;, 8485afa.</p>

</dd>
<dt id="added-flag--xci-to-improve-formatting-when--ci-and--i-are-equal-issue-git-28"><b>added flag -xci to improve formatting when -ci and -i are equal, issue git #28</b></dt>
<dd>

<p>This flag causes continuation indentation to &quot;extend&quot; deeper into structures. If you use <b>-ci=n</b> and <b>-i=n</b> with the same value of <b>n</b> you will probably want to set this flag. Since this is a fairly new flag, the default is <b>-nxci</b> to avoid disturbing existing formatting.</p>

</dd>
<dt id="terminal-braces-not-indenting-correctly-with--bli-formatting-issue-git-40"><b>terminal braces not indenting correctly with -bli formatting, issue git #40</b></dt>
<dd>

<p>This problem is illustrated with the following snippet when run with -bli -blil=&#39;*&#39;</p>

<pre><code>    #-bli -bli list=&#39;*&#39;
    try
      {
        die;
      }
    catch
      {
        die;
      };    # &lt;-- this was not indenting</code></pre>

<p>This was due to conflicting rules and was fixed 1 Oct 2020 in commit &#39;fix issue git #40, incorrect closing brace indentation with -bli&#39;, a5aefe9.</p>

<p>At the same time, it was noted that block types sort/map/grep and eval were not following -bli formatting when -blil=&#39;*&#39; and this was fixed. For example, with corrected formatting, we would have</p>

<pre><code>  # perltidy -bli -blil=&#39;*&#39;
    eval
      {
        my $app = App::perlbrew-&gt;new( &quot;install-patchperl&quot;, &quot;-q&quot; );
        $app-&gt;run();
      }
      or do
      {
        $error          = $@;
        $produced_error = 1;
      };</code></pre>

</dd>
</dl>

<h1 id="Issues-fixed-after-release-20200907">Issues fixed after release 20200907</h1>

<p>This is a detailed log of changes since the release 20200907. All bugs were found with the help of automated random testing.</p>

<dl>

<dt id="Keep-any-space-between-a-bareword-and-quote"><b>Keep any space between a bareword and quote</b></dt>
<dd>

<p>In random testing, the -mangle option introduced a syntax error by deleting the space between barewords and quotes (test file &#39;MxScreen&#39;), such as:</p>

<pre><code>  oops&quot;Your login, $Bad_Login, is not valid&quot;;</code></pre>

<p>Sub &#39;is_essential_whitespace&#39; was updated to prevent this on 27 Sep 2020, in &#39;keep any space between a bareword and quote&#39;, f32553c.</p>

</dd>
<dt id="Fixed-some-incorrect-indentation-disagreements-reported-in-LOG-file"><b>Fixed some incorrect indentation disagreements reported in LOG file</b></dt>
<dd>

<p>The .LOG file reports any disagreements between the indentation of the input and output files. This can help locate brace errors. These were incorrect when some of the options were used, including --whitespace-cycle, -bbhb, -nib. This was corrected 24 Sep 2020, &#39;fixed incorrect log entry for indentation disagreement&#39;, 3d40545. At the same time, locations of closing brace indentation disagreements are now tracked and reported in the .ERR file when there is a brace error. This can help localize the error if the file was previously formatted by perltidy.</p>

</dd>
<dt id="If-an-cut-starts-a-POD-section-within-code-give-a-warning"><b>If an =cut starts a POD section within code, give a warning</b></dt>
<dd>

<p>Previously only a complaint was given, which went into the log file and was not normally seen. Perl silently accepts this but it can cause significant problems with pod utilities, so a clear warning is better. This situation arose in testing on random files in combination with a -dp flag and it took some time to understand the results because of the lack of a warning.</p>

</dd>
<dt id="Switched-from-using-an-eval-block-to-the--can-function-for-sub-finish_formatting"><b>Switched from using an eval block to the -</b>can() function for sub finish_formatting&gt;</dt>
<dd>

<p>This is not a bug, but is cleaner coding and insures that error messages get reported. This change was made 20 Sep 2020, &#39;switch from eval { } to -&gt;can(&#39;finish_formatting&#39;)&#39;, 28f2a4f.</p>

</dd>
<dt id="fixed-uninitialized-value-reference"><b>fixed uninitialized value reference</b></dt>
<dd>

<p>The following message was generated during automated testing</p>

<pre><code> Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 12079.
 Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 12089.
 Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 12097.</code></pre>

<p>The problem could be simplified to running perltidy -wn on this snippet:</p>

<pre><code>     __PACKAGE__-&gt;load_components( qw(
&gt;         Core
&gt; 
&gt;     ) );</code></pre>

<p>This was fixed 20 Sep 2020 in &#39;fixed_uninitialized_value&#39;, 8d6c4ed.</p>

</dd>
<dt id="fix-incorrect-parsing-of-certain-deprecated-empty-here-docs"><b>fix incorrect parsing of certain deprecated empty here-docs </b></dt>
<dd>

<p>The following snippet was being incorrectly parsed:</p>

<pre><code> print &lt;&lt;
 # Hello World 13!
 
   ;
 print &quot;DONE\n&quot;;</code></pre>

<p>This is a deprecated here-doc without a specified target but currently still a valid program. It would have been correctly parsed if the semicolon followed the &#39;&lt;&lt;&#39; operator rather than the here-doc.</p>

<p>This was found in random testing and fixed 16 Sep 2020. A warning message about deprecated here-doc targets was added.</p>

</dd>
<dt id="make-the-arrow-a-vertical-alignment-token-git-39"><b>make the arrow a vertical alignment token, git #39</b></dt>
<dd>

<p>The -&gt; can now be vertically aligned if a space is placed before it with -wls=&#39;-&gt;&#39;. Added 15 Sep 2020 as part of previous item, 9ac6af6.</p>

</dd>
<dt id="add-flags--bbhb-n--bbsb-n-bbp-n-git-38"><b>add flags -bbhb=n, -bbsb=n, =bbp=n, git #38</b></dt>
<dd>

<p>These flags give control over the opening token of a multiple-line list. They are described in the man pages, perltidy.html. Added 15 Sep 2020 in &quot;added flags -bbhb=n, -bbsb=n, -bbq=n, suggestion git #38&quot;. 9ac6af6.</p>

</dd>
<dt id="Allow-vertical-alignment-of-line-ending-fat-comma"><b>Allow vertical alignment of line-ending fat comma</b></dt>
<dd>

<p>A change was made to allow a &#39;=&gt;&#39; at the end of a line to align vertically, provided that it aligns with two or more other &#39;=&gt;&#39; tokens. This update was 14 Sep 2020, &#39;Allow line-ending &#39;=&gt;&#39; to align vertically&#39;, ea96739.</p>

</dd>
<dt id="fixed-uninitialized-value-reference1"><b>fixed uninitialized value reference</b></dt>
<dd>

<p>The following message was generated when running perltidy on random text:</p>

<pre><code> Use of uninitialized value $K_semicolon in subtraction (-) at /home/steve/bin/Perl/Tidy/Formatter.pm line 16467.</code></pre>

<p>This was fixed 14 Sep 2020, included in &#39;Allow line-ending &#39;=&gt;&#39; to align vertically&#39;, ea96739.</p>

</dd>
<dt id="Do-not-create-a-zero-size-file-by-deleting-semicolons"><b>Do not create a zero size file by deleting semicolons</b></dt>
<dd>

<p>A rule was added to prevent a file consisting of a single semicolon</p>

<pre><code> ;</code></pre>

<p>from becoming a zero length file. This could cause problems with other software. Fixed 13 Sep 2020, &#39;do not create a zero length file by deleting semicolons&#39;, b39195e.</p>

</dd>
<dt id="fixed-uninitialized-value-reference2"><b>fixed uninitialized value reference</b></dt>
<dd>

<p>The following message was generated when running perltidy on random text:</p>

<pre><code> Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 11926.
 Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 11936.
 Use of uninitialized value $cti in numeric eq (==) at /home/steve/bin/Perl/Tidy/Formatter.pm line 11944.</code></pre>

<p>This was fixed 13 Sep 2020 in &#39;fixed unitialized variable problem &#39;, adb2096.</p>

</dd>
<dt id="fixed-uninitialized-value-reference3"><b>fixed uninitialized value reference</b></dt>
<dd>

<p>The following message was generated when running perltidy on random text:</p>

<pre><code> substr outside of string at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 7362.
 Use of uninitialized value in concatenation (.) or string at /home/steve/bin/Perl/Tidy/Tokenizer.pm line 7362.</code></pre>

<p>This was fixed 13 Sep 2020 in &#39;fixed unitialized variable problem&#39;, 5bf49a3.</p>

</dd>
<dt id="fixed-uninitialized-value-reference4"><b>fixed uninitialized value reference</b></dt>
<dd>

<p>The following message was generated when running perltidy on random text:</p>

<pre><code> Use of uninitialized value $K_opening in subtraction (-) at /home/steve/bin/Perl/Tidy/Formatter.pm line 16467.</code></pre>

<p>This was fixed 13 Sep 2020 in &#39;fix undefined variable reference&#39;, 1919482.</p>

</dd>
<dt id="hashbang-warning-changed"><b>hashbang warning changed</b></dt>
<dd>

<p>The following snippet generated a warning that there might be a hash-bang after the start of the script.</p>

<pre><code> $x = 2;
 #!  sunos does not yet provide a /usr/bin/perl
 $script = &quot;$^X $script&quot;;</code></pre>

<p>To prevent this annoyance, the warning is not given unless the first nonblank character after the &#39;#!&#39; is a &#39;/&#39;. Note that this change is just for the warning message. The actual hash bang check does not require the slash.</p>

<p>Fixed 13 Sep 2020, &#39;prevent unnecessary hash-bang warning message&#39; 4f7733e and &#39;improved hash-bang warning filter&#39;, fa84904.</p>

</dd>
<dt id="uninitialized-index-referenced"><b>uninitialized index referenced</b></dt>
<dd>

<p>An unitialized index was referenced when running on a file of randomly generated text:</p>

<pre><code>  Use of uninitialized value $K_oo in subtraction (-) at /home/steve/bin/Perl/Tidy/Formatter.pm line 7259.</code></pre>

<p>This was fixed 12 Sep 2020 in &#39;fixed undefined index&#39;, 616bb88.</p>

</dd>
<dt id="Oops-message-triggered"><b>Oops message triggered</b></dt>
<dd>

<p>The parameter combination -lp -wc triggered an internal bug message from perltidy:</p>

<pre><code> 398: Program bug with -lp.  seqno=77 should be 254 and i=1 should be less than max=-1
 713: The logfile perltidy.LOG may contain useful information
 713: 
 713: Oops, you seem to have encountered a bug in perltidy.  Please check the
 713: BUGS file at http://perltidy.sourceforge.net.  If the problem is not
 713: listed there, please report it so that it can be corrected.  Include the
 ...</code></pre>

<p>The problem is that the parameters --line-up-parentheses and --whitespace-cycle=n are not compatible. The fix is to write a message and turn off the -wc parameter when the both occur. This was fixed 8 Sep 2020 in &quot;do not allow -wc and -lp together, can cause bugs&quot;, 7103781.</p>

</dd>
<dt id="Internal-fault-detected-by-perltidy"><b>Internal fault detected by perltidy</b></dt>
<dd>

<p>This snippet after processing with the indicated parameters triggered a Fault message in store-token-to-go due to discontinuous internal index values :</p>

<pre><code>  perltidy --noadd-newlines --space-terminal-semicolon

  if ( $_ =~ /PENCIL/ ) { $pencil_flag= 1 } ; ;
  $yy=1;</code></pre>

<p>This triggered the message:</p>

<pre><code> ==============================================================================
 While operating on input stream with name: &#39;&lt;stdin&gt;&#39;
 A fault was detected at line 7472 of sub &#39;Perl::Tidy::Formatter::store_token_to_go&#39;
 in file &#39;/home/steve/bin/Perl/Tidy/Formatter.pm&#39;
 which was called from line 8298 of sub &#39;Perl::Tidy::Formatter::process_line_of_CODE&#39;
 Message: &#39;Unexpected break in K values: 591 != 589+1&#39;
 This is probably an error introduced by a recent programming change. 
 ==============================================================================</code></pre>

<p>The deletion of the extra, spaced, comma had created an extra space in the token array which had not been forseen in the original programming. It was fixed 10 Sep 2020 in &quot;fixed very rare fault found with automated testing&quot;, eb1b1d9.</p>

</dd>
<dt id="Error-parsing-deprecated-variable"><b>Error parsing deprecated $# variable</b></dt>
<dd>

<p>This problem can be illustrated with this two-line snippet:</p>

<pre><code>  $#
  eq$,?print&quot;yes\n&quot;:print&quot;no\n&quot;;</code></pre>

<p>Perltidy joined &#39;$#&#39; and &#39;eq&#39; to get $#eq, but should have stopped at the line end to get $# followed by keyword &#39;eq&#39;. (Note that $# is deprecated). This was fixed 11 Sep 2020 in &quot;fixed several fringe parsing bugs found in testing&quot;, 85e01b7.</p>

</dd>
<dt id="Error-message-parsing-a-file-with-angle-brackets-and-ternaries"><b>Error message parsing a file with angle brackets and ternaries</b></dt>
<dd>

<p>This problem can be illustrated with the following test snippet which was not correctly parsed.</p>

<pre><code> print$$ &lt;300?&quot;$$&lt;300\n&quot;:$$&lt;700?&quot;$$&lt;700\n&quot;:$$&lt;2_000?&quot;$$&lt;2,000\n&quot;:$$&lt;10_000?&quot;$$ &lt;10,000\n&quot;:&quot;$$&gt;9,999\n&quot;;</code></pre>

<p>The problem is related to the &#39;&lt;&#39; symbol following the &#39;$$&#39; variable, a possible filehandle, and is similar to a previous bug. The problem was corrected 11 Sep 2020 in &quot;fixed several fringe parsing bugs found in testing&quot;, 85e01b7. The line now correctly formats to</p>

<pre><code> print $$ &lt; 300  ? &quot;$$&lt;300\n&quot;
   : $$ &lt; 700    ? &quot;$$&lt;700\n&quot;
   : $$ &lt; 2_000  ? &quot;$$&lt;2,000\n&quot;
   : $$ &lt; 10_000 ? &quot;$$ &lt;10,000\n&quot;
   :               &quot;$$&gt;9,999\n&quot;;</code></pre>

</dd>
<dt id="code-crash-with-cuddled-else-formatting-on-unbalanced-files"><b>code crash with cuddled-else formatting on unbalanced files</b></dt>
<dd>

<p>A file with incorrect bracing which effectively gave negative indentation caused a crash when a stack was referenced with a negative index. The problem was fixed 8 Sept 2020 in &quot;convert array to hash to avoid trouble with neg levels in bad files&quot;, a720e0d.</p>

</dd>
<dt id="error-message-Unterminated-angle-operator"><b>error message &#39;Unterminated angle operator?&#39;</b></dt>
<dd>

<p>This error can be demonstrated with this line.</p>

<pre><code>  print $i &lt;10 ? &quot;yes&quot; : &quot;no&quot;;</code></pre>

<p>Perl has some strange parsing rules near a possible filehandle, and they change over time. The &#39;&lt;&#39; here is a less than symbol, but perltidy expected that it might be the start of an angle operator, based on the old rules, and gave a warning. The formatting was still correct, but the warning was confusing. This has been fixed 8 Sep 2020 in &#39;remove confusing warning message&#39;, 0a4d725.</p>

</dd>
<dt id="Line-broken-after-here-target"><b>Line broken after here target</b></dt>
<dd>

<p>This problem is illustrated with the following snippet</p>

<pre><code>  $sth= $dbh-&gt;prepare (&lt;&lt;&quot;END_OF_SELECT&quot;) or die &quot;Couldn&#39;t prepare SQL&quot; ;
      SELECT COUNT(duration),SUM(duration) 
      FROM logins WHERE username=&#39;$user&#39;
  END_OF_SELECT</code></pre>

<p>When run with a short line length it got broken after the here target, causing an error. This was due to a recent program change and fixed 7 Sep 2020 in &#39;fixed bug where long line with here target got broken&#39;, 8f7e4cb.</p>

</dd>
<dt id="undefined-variable-named-test2"><b>undefined variable named &#39;test2&#39;</b></dt>
<dd>

<p>An uninitialized value was being referenced and triggered this message:</p>

<pre><code> undefined test2, i_opening=5, max=18, caller=Perl::Tidy::Formatter ./perltidy-20200907.pl 13465
 Use of uninitialized value $test2 in numeric eq (==) at ./perltidy-20200907.pl line 19692.</code></pre>

<p>Fixed 8 Sep 2020 in &#39;fixed rare problem with stored index values for -lp option&#39;, 4147c8c.</p>

</dd>
<dt id="Line-order-switched-at-start-of-quoted-text"><b>Line order switched at start of quoted text</b></dt>
<dd>

<p>This problem arose in several scripts involving the parameter --line-up-parentheses pluse one or more of the vertical tightness flags. It can be illustrated with the following snippet:</p>

<pre><code>    perltidy --line-up-parentheses --paren-vertical-tightness=1

    if (
        ( $name, $chap ) =
        $cur_fname =~ m!^Bible/
          .*?/          # testament
          .*?/          # range of books
          (.*?)/        # book name
          .*?           # optional range of verses
          (\d+)$!x
      )
    {
        $cur_name = &quot;$name $chap&quot;;
    }</code></pre>

<p>This gave</p>

<pre><code>    if (( $name, $chap ) =
          .*?/          # testament
        $cur_fname =~ m!^Bible/
          .*?/          # range of books
          (.*?)/        # book name
          .*?           # optional range of verses
          (\d+)$!x
      )
    {
        $cur_name = &quot;$name $chap&quot;;
    }</code></pre>

<p>Notice the incorrect line order. The problem was an incorrect order of operations in the vertical aligner flush, leaving a line stranded and coming out in the wrong order. This was fixed 11 Sep 2020.</p>

</dd>
<dt id="crash-due-to-bad-index-named-j_terminal_match"><b>crash due to bad index named &#39;$j_terminal_match&#39;</b></dt>
<dd>

<p>This crash was due to an index error which caused a non-existent object to be referenced. The problem is fixed 2020-09-07 in &quot;fix problem of undefined values involving j_terminal_match&quot;, c5bfa77. The particular parameters which caused this were:</p>

<pre><code>    --noadd-newlines --nowant-left-space=&#39;=&#39; </code></pre>

</dd>
<dt id="an-issue-with-the--x-flag"><b>an issue with the -x flag</b></dt>
<dd>

<p>This is not a bug but did take some time to resolve. The problem was reduced to the following script run with the -x flag (--look-for-hash-bang)</p>

<pre><code> print(SCRIPT$headmaybe . &lt;&lt;EOB . &lt;&lt;&#39;EOF&#39; .$tailmaybe),$!;
 #!$wd/perl
 EOB
 print &quot;\$^X is $^X, \$0 is $0\n&quot;;
 EOF</code></pre>

<p>The resulting file had a syntax error (here-doc target EOB changed).</p>

<pre><code> print(SCRIPT$headmaybe . &lt;&lt;EOB . &lt;&lt;&#39;EOF&#39; .$tailmaybe),$!;
 #!$wd/perl
 EOB print &quot;\$^X is $^X, \$0 is $0\n&quot;;
 EOF</code></pre>

<p>The problem is that the -x flag tells perltidy not to start parsing until it sees a line starting with &#39;#!&#39;, which happens to be in a here-doc in this case.</p>

<p>A warning was added to the manual 7 Sept 2020 in &quot;add warning about inappropriate -x flag&quot;, fe66743.</p>

</dd>
<dt id="error-parsing-sub-signature"><b>error parsing sub signature</b></dt>
<dd>

<p>This problem was reduced to the following snippet:</p>

<pre><code> substr
 (
  $#
 )</code></pre>

<p>The deprecated variable &#39;$#&#39; was being parsed incorrectly, and this was due to an error in which the word &#39;substr&#39; followed by a paren was taken as the start of a sub signature. The problem was fixed 8 Sep 2020 in &#39;fix problem parsing sub prototypes&#39; 569e05f. The code</p>

<pre><code>  $container_type =~ /^sub/;</code></pre>

<p>was corrected to be</p>

<pre><code>  $container_type =~ /^sub\b/;</code></pre>

</dd>
<dt id="uninitialized-value-message-found-7-Sep-2020"><b>uninitialized value message, found 7 Sep 2020</b></dt>
<dd>

<p>Unitialized values were referenced. An index was not being tested. Fixed 8 Sep 2020 in &quot;fix undefined variable&quot;, 9729965.</p>

<pre><code> Use of uninitialized value $Kon in array element at /home/steve/bin/Perl/Tidy/Formatter.pm line 4022.
 Use of uninitialized value $Kon in array element at /home/steve/bin/Perl/Tidy/Formatter.pm line 4023.
 Use of uninitialized value $Ko in subtraction (-) at /home/steve/bin/Perl/Tidy/Formatter.pm line 4023.</code></pre>

</dd>
</dl>

<h1 id="Open-Issues">Open Issues</h1>

<p>These are known issues which have not been fixed.</p>

<dl>

<dt id="lexical-subs-not-fully-supported"><b>lexical subs not fully supported</b></dt>
<dd>

<p>Basic parsing of lexical subs works but some aspects of lexical subs are not yet functional. One of these is that unlike regular subs, lexical subs can override names of builtin functions.</p>

<p>First consider the following snippet</p>

<pre><code>  sub s { 
    my $arg=$_[0];
    print &quot;s called with arg $arg\n&quot;;
  }
  s(1);
  s(2);</code></pre>

<p>The &#39;s&#39; in the two last lines is the builtin s function, not the sub. Both perltidy and perl make the same assumption here. This program happens to still run but prints nothing. It will not run if the last semicolon is removed.</p>

<p>Now consider the following snippet in which the sub has a preceding &#39;my&#39;</p>

<pre><code>  use feature &#39;lexical_subs&#39;, &#39;signatures&#39;;
  my sub s { 
    my $arg=$_[0];
    print &quot;s called with arg $arg\n&quot;;
  }
  s(1);
  s(2);</code></pre>

<p>The builtin function &#39;s&#39; is replaced by the sub s here, and the program runs. Perltidy will format this but it is assuming that the s in the two last lines are the builtin s function. If the last semicolon is removed, there will be an formatting error. So perltidy and perl make different assumptions in this case.</p>

<p>Another issue is that perltidy does not yet remember the extent of the scope of a lexical sub.</p>

</dd>
<dt id="issues-with-paren-less-calls"><b>issues with paren-less calls</b></dt>
<dd>

<p>Consider the following snippet:</p>

<pre><code>  use Test::More;
  ok open($stdin, &quot;&lt;&amp;&quot;, $1), &#39;open ... &quot;&lt;&amp;&quot;, $magical_fileno&#39;, ||  _diag $!;</code></pre>

<p>Note the unusual situation of a comma followed by an &#39;||&#39;. Perltidy will format this satisfactorily but it will write an error message. The syntax is correct, however. Perl knows the prototype of the &#39;ok&#39; function, which is called here without parens, so the last comma marks the last arg and is needed to keep the || from attaching to the last arg.</p>

<p>Full support of peren-less calls will probably never be implemented in perltidy because it would require that it parse all of the modules used to find the prototypes. This would make it impossible to run perltidy on small snippets of code from within an editor.</p>

<p>The problem can be avoid if parens are used:</p>

<pre><code>  ok ( open($stdin, &quot;&lt;&amp;&quot;, $1), &#39;open ... &quot;&lt;&amp;&quot;, $magical_fileno&#39;) ||  _diag $!;</code></pre>

</dd>
<dt id="multiple-sub-paren-calls"><b>multiple sub paren calls</b></dt>
<dd>

<p>Perltidy currently flags as an error a closing paren followed by an opening paren, as in the following</p>

<pre><code>  $subsubs[0]()(0)</code></pre>

<p>This syntax is ok. The example is from test &#39;current_sub.t&#39; in perl5.31.</p>

</dd>
</dl>


</body>

</html>


